Commit b90cb538 authored by Omkar Kulkarni's avatar Omkar Kulkarni Committed by David S. Miller

qed: Update FW init functions to support FW 8.59.1.0

The qed_init_fw_func.c and qed_init_ops.c updated to support FW
version 8.59.1.0.
  - Support 16-bit VPORT WFQ (weighted fair queueing) weights.
  - Support WFQ (weighted fair queueing) weight per VPORT + TC.
  - Support allocation of Tx PQs(physical queues) per PF,VF.
  - Modify Global RL (rate limiter) upper bound configuration.
  - Update FW operation functions.
  - Update iro_arr[] array.

This patch also fixes the existing checkpatch warnings and few important
checks.
Signed-off-by: default avatarAriel Elior <aelior@marvell.com>
Signed-off-by: default avatarShai Malin <smalin@marvell.com>
Signed-off-by: default avatarOmkar Kulkarni <okulkarni@marvell.com>
Signed-off-by: default avatarPrabhakar Kushwaha <pkushwaha@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3091be06
...@@ -91,14 +91,14 @@ static inline u32 qed_db_addr_vf(u32 cid, u32 DEMS) ...@@ -91,14 +91,14 @@ static inline u32 qed_db_addr_vf(u32 cid, u32 DEMS)
} }
#define ALIGNED_TYPE_SIZE(type_name, p_hwfn) \ #define ALIGNED_TYPE_SIZE(type_name, p_hwfn) \
((sizeof(type_name) + (u32)(1 << (p_hwfn->cdev->cache_shift)) - 1) & \ ((sizeof(type_name) + (u32)(1 << ((p_hwfn)->cdev->cache_shift)) - 1) & \
~((1 << (p_hwfn->cdev->cache_shift)) - 1)) ~((1 << (p_hwfn->cdev->cache_shift)) - 1))
#define for_each_hwfn(cdev, i) for (i = 0; i < cdev->num_hwfns; i++) #define for_each_hwfn(cdev, i) for (i = 0; i < (cdev)->num_hwfns; i++)
#define D_TRINE(val, cond1, cond2, true1, true2, def) \ #define D_TRINE(val, cond1, cond2, true1, true2, def) \
(val == (cond1) ? true1 : \ ((val) == (cond1) ? true1 : \
(val == (cond2) ? true2 : def)) ((val) == (cond2) ? true2 : def))
/* forward */ /* forward */
struct qed_ptt_pool; struct qed_ptt_pool;
...@@ -512,7 +512,7 @@ enum qed_hsi_def_type { ...@@ -512,7 +512,7 @@ enum qed_hsi_def_type {
struct qed_simd_fp_handler { struct qed_simd_fp_handler {
void *token; void *token;
void (*func)(void *); void (*func)(void *cookie);
}; };
enum qed_slowpath_wq_flag { enum qed_slowpath_wq_flag {
...@@ -875,7 +875,6 @@ u32 qed_get_hsi_def_val(struct qed_dev *cdev, enum qed_hsi_def_type type); ...@@ -875,7 +875,6 @@ u32 qed_get_hsi_def_val(struct qed_dev *cdev, enum qed_hsi_def_type type);
#define NUM_OF_BTB_BLOCKS(dev) \ #define NUM_OF_BTB_BLOCKS(dev) \
qed_get_hsi_def_val(dev, QED_HSI_DEF_MAX_BTB_BLOCKS) qed_get_hsi_def_val(dev, QED_HSI_DEF_MAX_BTB_BLOCKS)
/** /**
* qed_concrete_to_sw_fid(): Get the sw function id from * qed_concrete_to_sw_fid(): Get the sw function id from
* the concrete value. * the concrete value.
...@@ -903,7 +902,6 @@ static inline u8 qed_concrete_to_sw_fid(struct qed_dev *cdev, ...@@ -903,7 +902,6 @@ static inline u8 qed_concrete_to_sw_fid(struct qed_dev *cdev,
} }
#define PKT_LB_TC 9 #define PKT_LB_TC 9
#define MAX_NUM_VOQS 20
int qed_configure_vport_wfq(struct qed_dev *cdev, u16 vp_id, u32 rate); int qed_configure_vport_wfq(struct qed_dev *cdev, u16 vp_id, u32 rate);
void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev,
...@@ -915,7 +913,7 @@ int qed_device_num_engines(struct qed_dev *cdev); ...@@ -915,7 +913,7 @@ int qed_device_num_engines(struct qed_dev *cdev);
void qed_set_fw_mac_addr(__le16 *fw_msb, void qed_set_fw_mac_addr(__le16 *fw_msb,
__le16 *fw_mid, __le16 *fw_lsb, u8 *mac); __le16 *fw_mid, __le16 *fw_lsb, u8 *mac);
#define QED_LEADING_HWFN(dev) (&dev->hwfns[0]) #define QED_LEADING_HWFN(dev) (&(dev)->hwfns[0])
#define QED_IS_CMT(dev) ((dev)->num_hwfns > 1) #define QED_IS_CMT(dev) ((dev)->num_hwfns > 1)
/* Macros for getting the engine-affinitized hwfn (FIR: fcoe,iscsi,roce) */ /* Macros for getting the engine-affinitized hwfn (FIR: fcoe,iscsi,roce) */
#define QED_FIR_AFFIN_HWFN(dev) (&(dev)->hwfns[dev->fir_affin]) #define QED_FIR_AFFIN_HWFN(dev) (&(dev)->hwfns[dev->fir_affin])
...@@ -936,7 +934,7 @@ void qed_set_fw_mac_addr(__le16 *fw_msb, ...@@ -936,7 +934,7 @@ void qed_set_fw_mac_addr(__le16 *fw_msb,
#define PQ_FLAGS_LLT (BIT(7)) #define PQ_FLAGS_LLT (BIT(7))
#define PQ_FLAGS_MTC (BIT(8)) #define PQ_FLAGS_MTC (BIT(8))
/* physical queue index for cm context intialization */ /* physical queue index for cm context initialization */
u16 qed_get_cm_pq_idx(struct qed_hwfn *p_hwfn, u32 pq_flags); u16 qed_get_cm_pq_idx(struct qed_hwfn *p_hwfn, u32 pq_flags);
u16 qed_get_cm_pq_idx_mcos(struct qed_hwfn *p_hwfn, u8 tc); u16 qed_get_cm_pq_idx_mcos(struct qed_hwfn *p_hwfn, u8 tc);
u16 qed_get_cm_pq_idx_vf(struct qed_hwfn *p_hwfn, u16 vf); u16 qed_get_cm_pq_idx_vf(struct qed_hwfn *p_hwfn, u16 vf);
...@@ -951,9 +949,9 @@ bool qed_edpm_enabled(struct qed_hwfn *p_hwfn); ...@@ -951,9 +949,9 @@ bool qed_edpm_enabled(struct qed_hwfn *p_hwfn);
/* Other Linux specific common definitions */ /* Other Linux specific common definitions */
#define DP_NAME(cdev) ((cdev)->name) #define DP_NAME(cdev) ((cdev)->name)
#define REG_ADDR(cdev, offset) (void __iomem *)((u8 __iomem *)\ #define REG_ADDR(cdev, offset) ((void __iomem *)((u8 __iomem *)\
(cdev->regview) + \ ((cdev)->regview) + \
(offset)) (offset)))
#define REG_RD(cdev, offset) readl(REG_ADDR(cdev, offset)) #define REG_RD(cdev, offset) readl(REG_ADDR(cdev, offset))
#define REG_WR(cdev, offset, val) writel((u32)val, REG_ADDR(cdev, offset)) #define REG_WR(cdev, offset, val) writel((u32)val, REG_ADDR(cdev, offset))
...@@ -961,7 +959,7 @@ bool qed_edpm_enabled(struct qed_hwfn *p_hwfn); ...@@ -961,7 +959,7 @@ bool qed_edpm_enabled(struct qed_hwfn *p_hwfn);
#define DOORBELL(cdev, db_addr, val) \ #define DOORBELL(cdev, db_addr, val) \
writel((u32)val, (void __iomem *)((u8 __iomem *)\ writel((u32)val, (void __iomem *)((u8 __iomem *)\
(cdev->doorbells) + (db_addr))) ((cdev)->doorbells) + (db_addr)))
#define MFW_PORT(_p_hwfn) ((_p_hwfn)->abs_pf_id % \ #define MFW_PORT(_p_hwfn) ((_p_hwfn)->abs_pf_id % \
qed_device_num_ports((_p_hwfn)->cdev)) qed_device_num_ports((_p_hwfn)->cdev))
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "qed_hsi.h" #include "qed_hsi.h"
#include "qed_hw.h" #include "qed_hw.h"
#include "qed_init_ops.h" #include "qed_init_ops.h"
#include "qed_iro_hsi.h"
#include "qed_reg_addr.h" #include "qed_reg_addr.h"
#include "qed_sriov.h" #include "qed_sriov.h"
...@@ -46,30 +47,32 @@ static u32 pxp_global_win[] = { ...@@ -46,30 +47,32 @@ static u32 pxp_global_win[] = {
/* IRO Array */ /* IRO Array */
static const u32 iro_arr[] = { static const u32 iro_arr[] = {
0x00000000, 0x00000000, 0x00080000, 0x00000000, 0x00000000, 0x00080000,
0x00004478, 0x00000008, 0x00080000,
0x00003288, 0x00000088, 0x00880000, 0x00003288, 0x00000088, 0x00880000,
0x000058e8, 0x00000020, 0x00200000, 0x000058a8, 0x00000020, 0x00200000,
0x00003188, 0x00000008, 0x00080000,
0x00000b00, 0x00000008, 0x00040000, 0x00000b00, 0x00000008, 0x00040000,
0x00000a80, 0x00000008, 0x00040000, 0x00000a80, 0x00000008, 0x00040000,
0x00000000, 0x00000008, 0x00020000, 0x00000000, 0x00000008, 0x00020000,
0x00000080, 0x00000008, 0x00040000, 0x00000080, 0x00000008, 0x00040000,
0x00000084, 0x00000008, 0x00020000, 0x00000084, 0x00000008, 0x00020000,
0x00005718, 0x00000004, 0x00040000, 0x00005798, 0x00000004, 0x00040000,
0x00004dd0, 0x00000000, 0x00780000, 0x00004e50, 0x00000000, 0x00780000,
0x00003e40, 0x00000000, 0x00780000, 0x00003e40, 0x00000000, 0x00780000,
0x00004480, 0x00000000, 0x00780000, 0x00004500, 0x00000000, 0x00780000,
0x00003210, 0x00000000, 0x00780000, 0x00003210, 0x00000000, 0x00780000,
0x00003b50, 0x00000000, 0x00780000, 0x00003b50, 0x00000000, 0x00780000,
0x00007f58, 0x00000000, 0x00780000, 0x00007f58, 0x00000000, 0x00780000,
0x00005f58, 0x00000000, 0x00080000, 0x00005fd8, 0x00000000, 0x00080000,
0x00007100, 0x00000000, 0x00080000, 0x00007100, 0x00000000, 0x00080000,
0x0000aea0, 0x00000000, 0x00080000, 0x0000af20, 0x00000000, 0x00080000,
0x00004398, 0x00000000, 0x00080000, 0x00004398, 0x00000000, 0x00080000,
0x0000a5a0, 0x00000000, 0x00080000, 0x0000a5a0, 0x00000000, 0x00080000,
0x0000bde8, 0x00000000, 0x00080000, 0x0000bde8, 0x00000000, 0x00080000,
0x00000020, 0x00000004, 0x00040000, 0x00000020, 0x00000004, 0x00040000,
0x000056c8, 0x00000010, 0x00100000, 0x00005688, 0x00000010, 0x00100000,
0x0000c210, 0x00000030, 0x00300000, 0x0000c210, 0x00000030, 0x00300000,
0x0000b088, 0x00000038, 0x00380000, 0x0000b108, 0x00000038, 0x00380000,
0x00003d20, 0x00000080, 0x00400000, 0x00003d20, 0x00000080, 0x00400000,
0x0000bf60, 0x00000000, 0x00040000, 0x0000bf60, 0x00000000, 0x00040000,
0x00004560, 0x00040080, 0x00040000, 0x00004560, 0x00040080, 0x00040000,
...@@ -77,11 +80,11 @@ static const u32 iro_arr[] = { ...@@ -77,11 +80,11 @@ static const u32 iro_arr[] = {
0x00003d60, 0x00000080, 0x00200000, 0x00003d60, 0x00000080, 0x00200000,
0x00008960, 0x00000040, 0x00300000, 0x00008960, 0x00000040, 0x00300000,
0x0000e840, 0x00000060, 0x00600000, 0x0000e840, 0x00000060, 0x00600000,
0x00004618, 0x00000080, 0x00380000, 0x00004698, 0x00000080, 0x00380000,
0x00010738, 0x000000c0, 0x00c00000, 0x000107b8, 0x000000c0, 0x00c00000,
0x000001f8, 0x00000002, 0x00020000, 0x000001f8, 0x00000002, 0x00020000,
0x0000a2a0, 0x00000000, 0x01080000, 0x0000a260, 0x00000000, 0x01080000,
0x0000a3a8, 0x00000008, 0x00080000, 0x0000a368, 0x00000008, 0x00080000,
0x000001c0, 0x00000008, 0x00080000, 0x000001c0, 0x00000008, 0x00080000,
0x000001f8, 0x00000008, 0x00080000, 0x000001f8, 0x00000008, 0x00080000,
0x00000ac0, 0x00000008, 0x00080000, 0x00000ac0, 0x00000008, 0x00080000,
...@@ -90,39 +93,46 @@ static const u32 iro_arr[] = { ...@@ -90,39 +93,46 @@ static const u32 iro_arr[] = {
0x00000280, 0x00000008, 0x00080000, 0x00000280, 0x00000008, 0x00080000,
0x00000680, 0x00080018, 0x00080000, 0x00000680, 0x00080018, 0x00080000,
0x00000b78, 0x00080018, 0x00020000, 0x00000b78, 0x00080018, 0x00020000,
0x0000c640, 0x00000050, 0x003c0000, 0x0000c600, 0x00000058, 0x003c0000,
0x00012038, 0x00000018, 0x00100000, 0x00012038, 0x00000020, 0x00100000,
0x00011b00, 0x00000040, 0x00180000, 0x00011b00, 0x00000048, 0x00180000,
0x000095d0, 0x00000050, 0x00200000, 0x00009650, 0x00000050, 0x00200000,
0x00008b10, 0x00000040, 0x00280000, 0x00008b10, 0x00000040, 0x00280000,
0x00011640, 0x00000018, 0x00100000, 0x000116c0, 0x00000018, 0x00100000,
0x0000c828, 0x00000048, 0x00380000, 0x0000c808, 0x00000048, 0x00380000,
0x00011710, 0x00000020, 0x00200000, 0x00011790, 0x00000020, 0x00200000,
0x00004650, 0x00000080, 0x00100000, 0x000046d0, 0x00000080, 0x00100000,
0x00003618, 0x00000010, 0x00100000, 0x00003618, 0x00000010, 0x00100000,
0x0000a968, 0x00000008, 0x00010000, 0x0000a9e8, 0x00000008, 0x00010000,
0x000097a0, 0x00000008, 0x00010000, 0x000097a0, 0x00000008, 0x00010000,
0x00011990, 0x00000008, 0x00010000, 0x00011a10, 0x00000008, 0x00010000,
0x0000f018, 0x00000008, 0x00010000, 0x0000e9f8, 0x00000008, 0x00010000,
0x00012628, 0x00000008, 0x00010000, 0x00012648, 0x00000008, 0x00010000,
0x00011da8, 0x00000008, 0x00010000, 0x000121c8, 0x00000008, 0x00010000,
0x0000aa78, 0x00000030, 0x00100000, 0x0000af08, 0x00000030, 0x00100000,
0x0000d768, 0x00000028, 0x00280000, 0x0000d748, 0x00000028, 0x00280000,
0x00009a58, 0x00000018, 0x00180000, 0x00009e68, 0x00000018, 0x00180000,
0x00009bd8, 0x00000008, 0x00080000, 0x00009fe8, 0x00000008, 0x00080000,
0x00013a18, 0x00000008, 0x00080000, 0x00013ea8, 0x00000008, 0x00080000,
0x000126e8, 0x00000018, 0x00180000, 0x00012f18, 0x00000018, 0x00180000,
0x0000e608, 0x00500288, 0x00100000, 0x0000dfe8, 0x00500288, 0x00100000,
0x00012970, 0x00000138, 0x00280000, 0x000131a0, 0x00000138, 0x00280000,
}; };
void qed_init_iro_array(struct qed_dev *cdev) void qed_init_iro_array(struct qed_dev *cdev)
{ {
cdev->iro_arr = iro_arr; cdev->iro_arr = iro_arr + E4_IRO_ARR_OFFSET;
} }
void qed_init_store_rt_reg(struct qed_hwfn *p_hwfn, u32 rt_offset, u32 val) void qed_init_store_rt_reg(struct qed_hwfn *p_hwfn, u32 rt_offset, u32 val)
{ {
if (rt_offset >= RUNTIME_ARRAY_SIZE) {
DP_ERR(p_hwfn,
"Avoid storing %u in rt_data at index %u!\n",
val, rt_offset);
return;
}
p_hwfn->rt_data.init_val[rt_offset] = val; p_hwfn->rt_data.init_val[rt_offset] = val;
p_hwfn->rt_data.b_valid[rt_offset] = true; p_hwfn->rt_data.b_valid[rt_offset] = true;
} }
...@@ -132,6 +142,14 @@ void qed_init_store_rt_agg(struct qed_hwfn *p_hwfn, ...@@ -132,6 +142,14 @@ void qed_init_store_rt_agg(struct qed_hwfn *p_hwfn,
{ {
size_t i; size_t i;
if ((rt_offset + size - 1) >= RUNTIME_ARRAY_SIZE) {
DP_ERR(p_hwfn,
"Avoid storing values in rt_data at indices %u-%u!\n",
rt_offset,
(u32)(rt_offset + size - 1));
return;
}
for (i = 0; i < size / sizeof(u32); i++) { for (i = 0; i < size / sizeof(u32); i++) {
p_hwfn->rt_data.init_val[rt_offset + i] = p_val[i]; p_hwfn->rt_data.init_val[rt_offset + i] = p_val[i];
p_hwfn->rt_data.b_valid[rt_offset + i] = true; p_hwfn->rt_data.b_valid[rt_offset + i] = true;
...@@ -175,7 +193,7 @@ static int qed_init_rt(struct qed_hwfn *p_hwfn, ...@@ -175,7 +193,7 @@ static int qed_init_rt(struct qed_hwfn *p_hwfn,
return rc; return rc;
/* invalidate after writing */ /* invalidate after writing */
for (j = i; j < i + segment; j++) for (j = i; j < (u32)(i + segment); j++)
p_valid[j] = false; p_valid[j] = false;
/* Jump over the entire segment, including invalid entry */ /* Jump over the entire segment, including invalid entry */
...@@ -245,7 +263,7 @@ static int qed_init_array_dmae(struct qed_hwfn *p_hwfn, ...@@ -245,7 +263,7 @@ static int qed_init_array_dmae(struct qed_hwfn *p_hwfn,
static int qed_init_fill_dmae(struct qed_hwfn *p_hwfn, static int qed_init_fill_dmae(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, struct qed_ptt *p_ptt,
u32 addr, u32 fill, u32 fill_count) u32 addr, u32 fill_count)
{ {
static u32 zero_buffer[DMAE_MAX_RW_SIZE]; static u32 zero_buffer[DMAE_MAX_RW_SIZE];
struct qed_dmae_params params = {}; struct qed_dmae_params params = {};
...@@ -372,7 +390,7 @@ static int qed_init_cmd_wr(struct qed_hwfn *p_hwfn, ...@@ -372,7 +390,7 @@ static int qed_init_cmd_wr(struct qed_hwfn *p_hwfn,
case INIT_SRC_ZEROS: case INIT_SRC_ZEROS:
data = le32_to_cpu(p_cmd->args.zeros_count); data = le32_to_cpu(p_cmd->args.zeros_count);
if (b_must_dmae || (b_can_dmae && (data >= 64))) if (b_must_dmae || (b_can_dmae && (data >= 64)))
rc = qed_init_fill_dmae(p_hwfn, p_ptt, addr, 0, data); rc = qed_init_fill_dmae(p_hwfn, p_ptt, addr, data);
else else
qed_init_fill(p_hwfn, p_ptt, addr, 0, data); qed_init_fill(p_hwfn, p_ptt, addr, 0, data);
break; break;
...@@ -419,7 +437,6 @@ static void qed_init_cmd_rd(struct qed_hwfn *p_hwfn, ...@@ -419,7 +437,6 @@ static void qed_init_cmd_rd(struct qed_hwfn *p_hwfn,
addr = GET_FIELD(data, INIT_READ_OP_ADDRESS) << 2; addr = GET_FIELD(data, INIT_READ_OP_ADDRESS) << 2;
poll = GET_FIELD(data, INIT_READ_OP_POLL_TYPE); poll = GET_FIELD(data, INIT_READ_OP_POLL_TYPE);
val = qed_rd(p_hwfn, p_ptt, addr); val = qed_rd(p_hwfn, p_ptt, addr);
if (poll == INIT_POLL_NONE) if (poll == INIT_POLL_NONE)
...@@ -515,8 +532,7 @@ static u32 qed_init_cmd_mode(struct qed_hwfn *p_hwfn, ...@@ -515,8 +532,7 @@ static u32 qed_init_cmd_mode(struct qed_hwfn *p_hwfn,
INIT_IF_MODE_OP_CMD_OFFSET); INIT_IF_MODE_OP_CMD_OFFSET);
} }
static u32 qed_init_cmd_phase(struct qed_hwfn *p_hwfn, static u32 qed_init_cmd_phase(struct init_if_phase_op *p_cmd,
struct init_if_phase_op *p_cmd,
u32 phase, u32 phase_id) u32 phase, u32 phase_id)
{ {
u32 data = le32_to_cpu(p_cmd->phase_data); u32 data = le32_to_cpu(p_cmd->phase_data);
...@@ -563,7 +579,7 @@ int qed_init_run(struct qed_hwfn *p_hwfn, ...@@ -563,7 +579,7 @@ int qed_init_run(struct qed_hwfn *p_hwfn,
modes); modes);
break; break;
case INIT_OP_IF_PHASE: case INIT_OP_IF_PHASE:
cmd_num += qed_init_cmd_phase(p_hwfn, &cmd->if_phase, cmd_num += qed_init_cmd_phase(&cmd->if_phase,
phase, phase_id); phase, phase_id);
break; break;
case INIT_OP_DELAY: case INIT_OP_DELAY:
......
...@@ -80,7 +80,7 @@ void qed_init_store_rt_agg(struct qed_hwfn *p_hwfn, ...@@ -80,7 +80,7 @@ void qed_init_store_rt_agg(struct qed_hwfn *p_hwfn,
size_t size); size_t size);
#define STORE_RT_REG_AGG(hwfn, offset, val) \ #define STORE_RT_REG_AGG(hwfn, offset, val) \
qed_init_store_rt_agg(hwfn, offset, (u32 *)&val, sizeof(val)) qed_init_store_rt_agg(hwfn, offset, (u32 *)&(val), sizeof(val))
/** /**
* qed_gtt_init(): Initialize GTT global windows and set admin window * qed_gtt_init(): Initialize GTT global windows and set admin window
......
...@@ -126,6 +126,8 @@ ...@@ -126,6 +126,8 @@
0x1009c4UL 0x1009c4UL
#define QM_REG_PF_EN \ #define QM_REG_PF_EN \
0x2f2ea4UL 0x2f2ea4UL
#define QM_REG_RLGLBLUPPERBOUND \
0x2f3c00UL
#define TCFC_REG_WEAK_ENABLE_VF \ #define TCFC_REG_WEAK_ENABLE_VF \
0x2d0704UL 0x2d0704UL
#define TCFC_REG_STRONG_ENABLE_PF \ #define TCFC_REG_STRONG_ENABLE_PF \
...@@ -576,7 +578,7 @@ ...@@ -576,7 +578,7 @@
#define PRS_REG_ENCAPSULATION_TYPE_EN 0x1f0730UL #define PRS_REG_ENCAPSULATION_TYPE_EN 0x1f0730UL
#define PRS_REG_GRE_PROTOCOL 0x1f0734UL #define PRS_REG_GRE_PROTOCOL 0x1f0734UL
#define PRS_REG_VXLAN_PORT 0x1f0738UL #define PRS_REG_VXLAN_PORT 0x1f0738UL
#define PRS_REG_OUTPUT_FORMAT_4_0_BB_K2 0x1f099cUL #define PRS_REG_OUTPUT_FORMAT_4_0 0x1f099cUL
#define NIG_REG_ENC_TYPE_ENABLE 0x501058UL #define NIG_REG_ENC_TYPE_ENABLE 0x501058UL
#define NIG_REG_ENC_TYPE_ENABLE_ETH_OVER_GRE_ENABLE (0x1 << 0) #define NIG_REG_ENC_TYPE_ENABLE_ETH_OVER_GRE_ENABLE (0x1 << 0)
...@@ -595,8 +597,9 @@ ...@@ -595,8 +597,9 @@
#define DORQ_REG_L2_EDPM_TUNNEL_GRE_ETH_EN 0x10090cUL #define DORQ_REG_L2_EDPM_TUNNEL_GRE_ETH_EN 0x10090cUL
#define DORQ_REG_L2_EDPM_TUNNEL_GRE_IP_EN 0x100910UL #define DORQ_REG_L2_EDPM_TUNNEL_GRE_IP_EN 0x100910UL
#define DORQ_REG_L2_EDPM_TUNNEL_VXLAN_EN 0x100914UL #define DORQ_REG_L2_EDPM_TUNNEL_VXLAN_EN 0x100914UL
#define DORQ_REG_L2_EDPM_TUNNEL_NGE_IP_EN_K2_E5 0x10092cUL #define DORQ_REG_L2_EDPM_TUNNEL_NGE_IP_EN_K2 0x10092cUL
#define DORQ_REG_L2_EDPM_TUNNEL_NGE_ETH_EN_K2_E5 0x100930UL #define DORQ_REG_L2_EDPM_TUNNEL_NGE_ETH_EN_K2 0x100930UL
#define NIG_REG_NGE_IP_ENABLE 0x508b28UL #define NIG_REG_NGE_IP_ENABLE 0x508b28UL
#define NIG_REG_NGE_ETH_ENABLE 0x508b2cUL #define NIG_REG_NGE_ETH_ENABLE 0x508b2cUL
...@@ -606,7 +609,10 @@ ...@@ -606,7 +609,10 @@
#define QM_REG_WFQPFWEIGHT 0x2f4e80UL #define QM_REG_WFQPFWEIGHT 0x2f4e80UL
#define QM_REG_WFQVPWEIGHT 0x2fa000UL #define QM_REG_WFQVPWEIGHT 0x2fa000UL
#define QM_REG_WFQVPUPPERBOUND \
0x2fb000UL
#define QM_REG_WFQVPCRD \
0x2fc000UL
#define PGLCS_REG_DBG_SELECT_K2_E5 \ #define PGLCS_REG_DBG_SELECT_K2_E5 \
0x001d14UL 0x001d14UL
#define PGLCS_REG_DBG_DWORD_ENABLE_K2_E5 \ #define PGLCS_REG_DBG_DWORD_ENABLE_K2_E5 \
......
...@@ -3580,48 +3580,73 @@ qed_iov_vf_flr_poll_dorq(struct qed_hwfn *p_hwfn, ...@@ -3580,48 +3580,73 @@ qed_iov_vf_flr_poll_dorq(struct qed_hwfn *p_hwfn,
return 0; return 0;
} }
#define MAX_NUM_EXT_VOQS (MAX_NUM_PORTS * NUM_OF_TCS)
static int static int
qed_iov_vf_flr_poll_pbf(struct qed_hwfn *p_hwfn, qed_iov_vf_flr_poll_pbf(struct qed_hwfn *p_hwfn,
struct qed_vf_info *p_vf, struct qed_ptt *p_ptt) struct qed_vf_info *p_vf, struct qed_ptt *p_ptt)
{ {
u32 cons[MAX_NUM_VOQS], distance[MAX_NUM_VOQS]; u32 prod, cons[MAX_NUM_EXT_VOQS], distance[MAX_NUM_EXT_VOQS], tmp;
int i, cnt; u8 max_phys_tcs_per_port = p_hwfn->qm_info.max_phys_tcs_per_port;
u8 max_ports_per_engine = p_hwfn->cdev->num_ports_in_engine;
u32 prod_voq0_addr = PBF_REG_NUM_BLOCKS_ALLOCATED_PROD_VOQ0;
u32 cons_voq0_addr = PBF_REG_NUM_BLOCKS_ALLOCATED_CONS_VOQ0;
u8 port_id, tc, tc_id = 0, voq = 0;
int cnt;
/* Read initial consumers & producers */ memset(cons, 0, MAX_NUM_EXT_VOQS * sizeof(u32));
for (i = 0; i < MAX_NUM_VOQS; i++) { memset(distance, 0, MAX_NUM_EXT_VOQS * sizeof(u32));
u32 prod;
cons[i] = qed_rd(p_hwfn, p_ptt, /* Read initial consumers & producers */
PBF_REG_NUM_BLOCKS_ALLOCATED_CONS_VOQ0 + for (port_id = 0; port_id < max_ports_per_engine; port_id++) {
i * 0x40); /* "max_phys_tcs_per_port" active TCs + 1 pure LB TC */
for (tc = 0; tc < max_phys_tcs_per_port + 1; tc++) {
tc_id = (tc < max_phys_tcs_per_port) ? tc : PURE_LB_TC;
voq = VOQ(port_id, tc_id, max_phys_tcs_per_port);
cons[voq] = qed_rd(p_hwfn, p_ptt,
cons_voq0_addr + voq * 0x40);
prod = qed_rd(p_hwfn, p_ptt, prod = qed_rd(p_hwfn, p_ptt,
PBF_REG_NUM_BLOCKS_ALLOCATED_PROD_VOQ0 + prod_voq0_addr + voq * 0x40);
i * 0x40); distance[voq] = prod - cons[voq];
distance[i] = prod - cons[i]; }
} }
/* Wait for consumers to pass the producers */ /* Wait for consumers to pass the producers */
i = 0; port_id = 0;
tc = 0;
for (cnt = 0; cnt < 50; cnt++) { for (cnt = 0; cnt < 50; cnt++) {
for (; i < MAX_NUM_VOQS; i++) { for (; port_id < max_ports_per_engine; port_id++) {
u32 tmp; /* "max_phys_tcs_per_port" active TCs + 1 pure LB TC */
for (; tc < max_phys_tcs_per_port + 1; tc++) {
tc_id = (tc < max_phys_tcs_per_port) ?
tc : PURE_LB_TC;
voq = VOQ(port_id,
tc_id, max_phys_tcs_per_port);
tmp = qed_rd(p_hwfn, p_ptt, tmp = qed_rd(p_hwfn, p_ptt,
PBF_REG_NUM_BLOCKS_ALLOCATED_CONS_VOQ0 + cons_voq0_addr + voq * 0x40);
i * 0x40); if (distance[voq] > tmp - cons[voq])
if (distance[i] > tmp - cons[i])
break; break;
} }
if (i == MAX_NUM_VOQS) if (tc == max_phys_tcs_per_port + 1)
tc = 0;
else
break;
}
if (port_id == max_ports_per_engine)
break; break;
msleep(20); msleep(20);
} }
if (cnt == 50) { if (cnt == 50) {
DP_ERR(p_hwfn, "VF[%d] - pbf polling failed on VOQ %d\n", DP_ERR(p_hwfn, "VF[%d]: pbf poll failed on VOQ%d\n",
p_vf->abs_vf_id, i); p_vf->abs_vf_id, (int)voq);
DP_ERR(p_hwfn, "VOQ %d has port_id as %d and tc_id as %d]\n",
(int)voq, (int)port_id, (int)tc_id);
return -EBUSY; return -EBUSY;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment