Commit 9c79ddaa authored by Mintz, Yuval's avatar Mintz, Yuval Committed by David S. Miller

qed*: Add support for QL41xxx adapters

This adds the necessary infrastructure changes for initializing
and working with the new series of QL41xxx adapaters.

It also adds 2 new PCI device-IDs to qede:
  - 0x8070 for QL41xxx PFs
  - 0x8090 for VFs spawning from QL41xxx PFs
Signed-off-by: default avatarTomer Tayar <Tomer.Tayar@cavium.com>
Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 942c56ad
...@@ -219,7 +219,9 @@ enum QED_PORT_MODE { ...@@ -219,7 +219,9 @@ enum QED_PORT_MODE {
QED_PORT_MODE_DE_4X20G, QED_PORT_MODE_DE_4X20G,
QED_PORT_MODE_DE_1X40G, QED_PORT_MODE_DE_1X40G,
QED_PORT_MODE_DE_2X25G, QED_PORT_MODE_DE_2X25G,
QED_PORT_MODE_DE_1X25G QED_PORT_MODE_DE_1X25G,
QED_PORT_MODE_DE_4X25G,
QED_PORT_MODE_DE_2X10G,
}; };
enum qed_dev_cap { enum qed_dev_cap {
...@@ -364,7 +366,8 @@ struct qed_hwfn { ...@@ -364,7 +366,8 @@ struct qed_hwfn {
#define IS_LEAD_HWFN(edev) (!((edev)->my_id)) #define IS_LEAD_HWFN(edev) (!((edev)->my_id))
u8 rel_pf_id; /* Relative to engine*/ u8 rel_pf_id; /* Relative to engine*/
u8 abs_pf_id; u8 abs_pf_id;
#define QED_PATH_ID(_p_hwfn) ((_p_hwfn)->abs_pf_id & 1) #define QED_PATH_ID(_p_hwfn) \
(QED_IS_K2((_p_hwfn)->cdev) ? 0 : ((_p_hwfn)->abs_pf_id & 1))
u8 port_id; u8 port_id;
bool b_active; bool b_active;
...@@ -523,9 +526,7 @@ struct qed_dev { ...@@ -523,9 +526,7 @@ struct qed_dev {
u8 dp_level; u8 dp_level;
char name[NAME_SIZE]; char name[NAME_SIZE];
u8 type; enum qed_dev_type type;
#define QED_DEV_TYPE_BB (0 << 0)
#define QED_DEV_TYPE_AH BIT(0)
/* Translate type/revision combo into the proper conditions */ /* Translate type/revision combo into the proper conditions */
#define QED_IS_BB(dev) ((dev)->type == QED_DEV_TYPE_BB) #define QED_IS_BB(dev) ((dev)->type == QED_DEV_TYPE_BB)
#define QED_IS_BB_A0(dev) (QED_IS_BB(dev) && \ #define QED_IS_BB_A0(dev) (QED_IS_BB(dev) && \
...@@ -540,6 +541,9 @@ struct qed_dev { ...@@ -540,6 +541,9 @@ struct qed_dev {
u16 vendor_id; u16 vendor_id;
u16 device_id; u16 device_id;
#define QED_DEV_ID_MASK 0xff00
#define QED_DEV_ID_MASK_BB 0x1600
#define QED_DEV_ID_MASK_AH 0x8000
u16 chip_num; u16 chip_num;
#define CHIP_NUM_MASK 0xffff #define CHIP_NUM_MASK 0xffff
...@@ -654,10 +658,16 @@ struct qed_dev { ...@@ -654,10 +658,16 @@ struct qed_dev {
u32 rdma_max_srq_sge; u32 rdma_max_srq_sge;
}; };
#define NUM_OF_VFS(dev) MAX_NUM_VFS_BB #define NUM_OF_VFS(dev) (QED_IS_BB(dev) ? MAX_NUM_VFS_BB \
#define NUM_OF_L2_QUEUES(dev) MAX_NUM_L2_QUEUES_BB : MAX_NUM_VFS_K2)
#define NUM_OF_SBS(dev) MAX_SB_PER_PATH_BB #define NUM_OF_L2_QUEUES(dev) (QED_IS_BB(dev) ? MAX_NUM_L2_QUEUES_BB \
#define NUM_OF_ENG_PFS(dev) MAX_NUM_PFS_BB : MAX_NUM_L2_QUEUES_K2)
#define NUM_OF_PORTS(dev) (QED_IS_BB(dev) ? MAX_NUM_PORTS_BB \
: MAX_NUM_PORTS_K2)
#define NUM_OF_SBS(dev) (QED_IS_BB(dev) ? MAX_SB_PER_PATH_BB \
: MAX_SB_PER_PATH_K2)
#define NUM_OF_ENG_PFS(dev) (QED_IS_BB(dev) ? MAX_NUM_PFS_BB \
: MAX_NUM_PFS_K2)
/** /**
* @brief qed_concrete_to_sw_fid - get the sw function id from * @brief qed_concrete_to_sw_fid - get the sw function id from
...@@ -694,6 +704,7 @@ void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, ...@@ -694,6 +704,7 @@ void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev,
void qed_clean_wfq_db(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); void qed_clean_wfq_db(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
#define QED_LEADING_HWFN(dev) (&dev->hwfns[0]) #define QED_LEADING_HWFN(dev) (&dev->hwfns[0])
int qed_device_num_engines(struct qed_dev *cdev);
/* Other Linux specific common definitions */ /* Other Linux specific common definitions */
#define DP_NAME(cdev) ((cdev)->name) #define DP_NAME(cdev) ((cdev)->name)
......
...@@ -1557,7 +1557,7 @@ static enum dbg_status qed_dbg_dev_init(struct qed_hwfn *p_hwfn, ...@@ -1557,7 +1557,7 @@ static enum dbg_status qed_dbg_dev_init(struct qed_hwfn *p_hwfn,
dev_data->mode_enable[MODE_K2] = 1; dev_data->mode_enable[MODE_K2] = 1;
} else if (QED_IS_BB_B0(p_hwfn->cdev)) { } else if (QED_IS_BB_B0(p_hwfn->cdev)) {
dev_data->chip_id = CHIP_BB_B0; dev_data->chip_id = CHIP_BB_B0;
dev_data->mode_enable[MODE_BB_B0] = 1; dev_data->mode_enable[MODE_BB] = 1;
} else { } else {
return DBG_STATUS_UNKNOWN_CHIP; return DBG_STATUS_UNKNOWN_CHIP;
} }
......
This diff is collapsed.
...@@ -2502,7 +2502,7 @@ struct fw_info_location { ...@@ -2502,7 +2502,7 @@ struct fw_info_location {
enum init_modes { enum init_modes {
MODE_RESERVED, MODE_RESERVED,
MODE_BB_B0, MODE_BB,
MODE_K2, MODE_K2,
MODE_ASIC, MODE_ASIC,
MODE_RESERVED2, MODE_RESERVED2,
...@@ -9431,11 +9431,24 @@ struct eth_stats { ...@@ -9431,11 +9431,24 @@ struct eth_stats {
u64 r511; u64 r511;
u64 r1023; u64 r1023;
u64 r1518; u64 r1518;
u64 r1522;
u64 r2047; union {
u64 r4095; struct {
u64 r9216; u64 r1522;
u64 r16383; u64 r2047;
u64 r4095;
u64 r9216;
u64 r16383;
} bb0;
struct {
u64 unused1;
u64 r1519_to_max;
u64 unused2;
u64 unused3;
u64 unused4;
} ah0;
} u0;
u64 rfcs; u64 rfcs;
u64 rxcf; u64 rxcf;
u64 rxpf; u64 rxpf;
...@@ -9452,14 +9465,36 @@ struct eth_stats { ...@@ -9452,14 +9465,36 @@ struct eth_stats {
u64 t511; u64 t511;
u64 t1023; u64 t1023;
u64 t1518; u64 t1518;
u64 t2047;
u64 t4095; union {
u64 t9216; struct {
u64 t16383; u64 t2047;
u64 t4095;
u64 t9216;
u64 t16383;
} bb1;
struct {
u64 t1519_to_max;
u64 unused6;
u64 unused7;
u64 unused8;
} ah1;
} u1;
u64 txpf; u64 txpf;
u64 txpp; u64 txpp;
u64 tlpiec;
u64 tncl; union {
struct {
u64 tlpiec;
u64 tncl;
} bb2;
struct {
u64 unused9;
u64 unused10;
} ah2;
} u2;
u64 rbyte; u64 rbyte;
u64 rxuca; u64 rxuca;
u64 rxmca; u64 rxmca;
...@@ -10263,6 +10298,8 @@ struct nvm_cfg1_glob { ...@@ -10263,6 +10298,8 @@ struct nvm_cfg1_glob {
#define NVM_CFG1_GLOB_NETWORK_PORT_MODE_2X25G 0xC #define NVM_CFG1_GLOB_NETWORK_PORT_MODE_2X25G 0xC
#define NVM_CFG1_GLOB_NETWORK_PORT_MODE_1X25G 0xD #define NVM_CFG1_GLOB_NETWORK_PORT_MODE_1X25G 0xD
#define NVM_CFG1_GLOB_NETWORK_PORT_MODE_4X25G 0xE #define NVM_CFG1_GLOB_NETWORK_PORT_MODE_4X25G 0xE
#define NVM_CFG1_GLOB_NETWORK_PORT_MODE_2X10G 0xF
u32 e_lane_cfg1; u32 e_lane_cfg1;
u32 e_lane_cfg2; u32 e_lane_cfg2;
u32 f_lane_cfg1; u32 f_lane_cfg1;
......
This diff is collapsed.
...@@ -238,6 +238,7 @@ int qed_fill_dev_info(struct qed_dev *cdev, ...@@ -238,6 +238,7 @@ int qed_fill_dev_info(struct qed_dev *cdev,
dev_info->rdma_supported = (cdev->hwfns[0].hw_info.personality == dev_info->rdma_supported = (cdev->hwfns[0].hw_info.personality ==
QED_PCI_ETH_ROCE); QED_PCI_ETH_ROCE);
dev_info->is_mf_default = IS_MF_DEFAULT(&cdev->hwfns[0]); dev_info->is_mf_default = IS_MF_DEFAULT(&cdev->hwfns[0]);
dev_info->dev_type = cdev->type;
ether_addr_copy(dev_info->hw_mac, cdev->hwfns[0].hw_info.hw_mac_addr); ether_addr_copy(dev_info->hw_mac, cdev->hwfns[0].hw_info.hw_mac_addr);
if (IS_PF(cdev)) { if (IS_PF(cdev)) {
...@@ -1653,8 +1654,10 @@ void qed_get_protocol_stats(struct qed_dev *cdev, ...@@ -1653,8 +1654,10 @@ void qed_get_protocol_stats(struct qed_dev *cdev,
switch (type) { switch (type) {
case QED_MCP_LAN_STATS: case QED_MCP_LAN_STATS:
qed_get_vport_stats(cdev, &eth_stats); qed_get_vport_stats(cdev, &eth_stats);
stats->lan_stats.ucast_rx_pkts = eth_stats.rx_ucast_pkts; stats->lan_stats.ucast_rx_pkts =
stats->lan_stats.ucast_tx_pkts = eth_stats.tx_ucast_pkts; eth_stats.common.rx_ucast_pkts;
stats->lan_stats.ucast_tx_pkts =
eth_stats.common.tx_ucast_pkts;
stats->lan_stats.fcs_err = -1; stats->lan_stats.fcs_err = -1;
break; break;
case QED_MCP_FCOE_STATS: case QED_MCP_FCOE_STATS:
......
...@@ -479,11 +479,10 @@ int qed_mcp_bist_nvm_test_get_image_att(struct qed_hwfn *p_hwfn, ...@@ -479,11 +479,10 @@ int qed_mcp_bist_nvm_test_get_image_att(struct qed_hwfn *p_hwfn,
rel_pfid) rel_pfid)
#define MCP_PF_ID(p_hwfn) MCP_PF_ID_BY_REL(p_hwfn, (p_hwfn)->rel_pf_id) #define MCP_PF_ID(p_hwfn) MCP_PF_ID_BY_REL(p_hwfn, (p_hwfn)->rel_pf_id)
/* TODO - this is only correct as long as only BB is supported, and #define MFW_PORT(_p_hwfn) ((_p_hwfn)->abs_pf_id % \
* no port-swapping is implemented; Afterwards we'll need to fix it. ((_p_hwfn)->cdev->num_ports_in_engines * \
*/ qed_device_num_engines((_p_hwfn)->cdev)))
#define MFW_PORT(_p_hwfn) ((_p_hwfn)->abs_pf_id % \
((_p_hwfn)->cdev->num_ports_in_engines * 2))
struct qed_mcp_info { struct qed_mcp_info {
/* Spinlock used for protecting the access to the MFW mailbox */ /* Spinlock used for protecting the access to the MFW mailbox */
spinlock_t lock; spinlock_t lock;
......
...@@ -262,12 +262,20 @@ static int qed_ptp_hw_enable(struct qed_dev *cdev) ...@@ -262,12 +262,20 @@ static int qed_ptp_hw_enable(struct qed_dev *cdev)
qed_wr(p_hwfn, p_ptt, NIG_REG_TS_OUTPUT_ENABLE_PDA, 0x1); qed_wr(p_hwfn, p_ptt, NIG_REG_TS_OUTPUT_ENABLE_PDA, 0x1);
/* Pause free running counter */ /* Pause free running counter */
qed_wr(p_hwfn, p_ptt, NIG_REG_TIMESYNC_GEN_REG_BB, 2); if (QED_IS_BB_B0(p_hwfn->cdev))
qed_wr(p_hwfn, p_ptt, NIG_REG_TIMESYNC_GEN_REG_BB, 2);
if (QED_IS_AH(p_hwfn->cdev))
qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_FREECNT_UPDATE_K2, 2);
qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_FREE_CNT_VALUE_LSB, 0); qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_FREE_CNT_VALUE_LSB, 0);
qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_FREE_CNT_VALUE_MSB, 0); qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_FREE_CNT_VALUE_MSB, 0);
/* Resume free running counter */ /* Resume free running counter */
qed_wr(p_hwfn, p_ptt, NIG_REG_TIMESYNC_GEN_REG_BB, 4); if (QED_IS_BB_B0(p_hwfn->cdev))
qed_wr(p_hwfn, p_ptt, NIG_REG_TIMESYNC_GEN_REG_BB, 4);
if (QED_IS_AH(p_hwfn->cdev)) {
qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_FREECNT_UPDATE_K2, 4);
qed_wr(p_hwfn, p_ptt, NIG_REG_PTP_LATCH_OSTS_PKT_TIME, 1);
}
/* Disable drift register */ /* Disable drift register */
qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_DRIFT_CNTR_CONF, 0x0); qed_wr(p_hwfn, p_ptt, NIG_REG_TSGEN_DRIFT_CNTR_CONF, 0x0);
......
...@@ -160,13 +160,13 @@ ...@@ -160,13 +160,13 @@
0x2e0704UL 0x2e0704UL
#define CCFC_REG_STRONG_ENABLE_PF \ #define CCFC_REG_STRONG_ENABLE_PF \
0x2e0708UL 0x2e0708UL
#define PGLUE_B_REG_PGL_ADDR_88_F0 \ #define PGLUE_B_REG_PGL_ADDR_88_F0_BB \
0x2aa404UL 0x2aa404UL
#define PGLUE_B_REG_PGL_ADDR_8C_F0 \ #define PGLUE_B_REG_PGL_ADDR_8C_F0_BB \
0x2aa408UL 0x2aa408UL
#define PGLUE_B_REG_PGL_ADDR_90_F0 \ #define PGLUE_B_REG_PGL_ADDR_90_F0_BB \
0x2aa40cUL 0x2aa40cUL
#define PGLUE_B_REG_PGL_ADDR_94_F0 \ #define PGLUE_B_REG_PGL_ADDR_94_F0_BB \
0x2aa410UL 0x2aa410UL
#define PGLUE_B_REG_WAS_ERROR_PF_31_0_CLR \ #define PGLUE_B_REG_WAS_ERROR_PF_31_0_CLR \
0x2aa138UL 0x2aa138UL
...@@ -1550,4 +1550,13 @@ ...@@ -1550,4 +1550,13 @@
#define NIG_REG_TIMESYNC_GEN_REG_BB 0x500d00UL #define NIG_REG_TIMESYNC_GEN_REG_BB 0x500d00UL
#define NIG_REG_TSGEN_FREE_CNT_VALUE_LSB 0x5088a8UL #define NIG_REG_TSGEN_FREE_CNT_VALUE_LSB 0x5088a8UL
#define NIG_REG_TSGEN_FREE_CNT_VALUE_MSB 0x5088acUL #define NIG_REG_TSGEN_FREE_CNT_VALUE_MSB 0x5088acUL
#define NIG_REG_PTP_LATCH_OSTS_PKT_TIME 0x509040UL
#define PGLUE_B_REG_PGL_ADDR_E8_F0_K2 0x2aaf98UL
#define PGLUE_B_REG_PGL_ADDR_EC_F0_K2 0x2aaf9cUL
#define PGLUE_B_REG_PGL_ADDR_F0_F0_K2 0x2aafa0UL
#define PGLUE_B_REG_PGL_ADDR_F4_F0_K2 0x2aafa4UL
#define NIG_REG_TSGEN_FREECNT_UPDATE_K2 0x509008UL
#define CNIG_REG_NIG_PORT0_CONF_K2 0x218200UL
#endif #endif
...@@ -557,14 +557,30 @@ int qed_iov_hw_info(struct qed_hwfn *p_hwfn) ...@@ -557,14 +557,30 @@ int qed_iov_hw_info(struct qed_hwfn *p_hwfn)
return 0; return 0;
} }
/* Calculate the first VF index - this is a bit tricky; Basically, /* First VF index based on offset is tricky:
* VFs start at offset 16 relative to PF0, and 2nd engine VFs begin * - If ARI is supported [likely], offset - (16 - pf_id) would
* after the first engine's VFs. * provide the number for eng0. 2nd engine Vfs would begin
* after the first engine's VFs.
* - If !ARI, VFs would start on next device.
* so offset - (256 - pf_id) would provide the number.
* Utilize the fact that (256 - pf_id) is achieved only by later
* to diffrentiate between the two.
*/ */
cdev->p_iov_info->first_vf_in_pf = p_hwfn->cdev->p_iov_info->offset +
p_hwfn->abs_pf_id - 16; if (p_hwfn->cdev->p_iov_info->offset < (256 - p_hwfn->abs_pf_id)) {
if (QED_PATH_ID(p_hwfn)) u32 first = p_hwfn->cdev->p_iov_info->offset +
cdev->p_iov_info->first_vf_in_pf -= MAX_NUM_VFS_BB; p_hwfn->abs_pf_id - 16;
cdev->p_iov_info->first_vf_in_pf = first;
if (QED_PATH_ID(p_hwfn))
cdev->p_iov_info->first_vf_in_pf -= MAX_NUM_VFS_BB;
} else {
u32 first = p_hwfn->cdev->p_iov_info->offset +
p_hwfn->abs_pf_id - 256;
cdev->p_iov_info->first_vf_in_pf = first;
}
DP_VERBOSE(p_hwfn, QED_MSG_IOV, DP_VERBOSE(p_hwfn, QED_MSG_IOV,
"First VF in hwfn 0x%08x\n", "First VF in hwfn 0x%08x\n",
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
#define DRV_MODULE_SYM qede #define DRV_MODULE_SYM qede
struct qede_stats { struct qede_stats_common {
u64 no_buff_discards; u64 no_buff_discards;
u64 packet_too_big_discard; u64 packet_too_big_discard;
u64 ttl0_discard; u64 ttl0_discard;
...@@ -90,11 +90,6 @@ struct qede_stats { ...@@ -90,11 +90,6 @@ struct qede_stats {
u64 rx_256_to_511_byte_packets; u64 rx_256_to_511_byte_packets;
u64 rx_512_to_1023_byte_packets; u64 rx_512_to_1023_byte_packets;
u64 rx_1024_to_1518_byte_packets; u64 rx_1024_to_1518_byte_packets;
u64 rx_1519_to_1522_byte_packets;
u64 rx_1519_to_2047_byte_packets;
u64 rx_2048_to_4095_byte_packets;
u64 rx_4096_to_9216_byte_packets;
u64 rx_9217_to_16383_byte_packets;
u64 rx_crc_errors; u64 rx_crc_errors;
u64 rx_mac_crtl_frames; u64 rx_mac_crtl_frames;
u64 rx_pause_frames; u64 rx_pause_frames;
...@@ -111,17 +106,39 @@ struct qede_stats { ...@@ -111,17 +106,39 @@ struct qede_stats {
u64 tx_256_to_511_byte_packets; u64 tx_256_to_511_byte_packets;
u64 tx_512_to_1023_byte_packets; u64 tx_512_to_1023_byte_packets;
u64 tx_1024_to_1518_byte_packets; u64 tx_1024_to_1518_byte_packets;
u64 tx_pause_frames;
u64 tx_pfc_frames;
u64 brb_truncates;
u64 brb_discards;
u64 tx_mac_ctrl_frames;
};
struct qede_stats_bb {
u64 rx_1519_to_1522_byte_packets;
u64 rx_1519_to_2047_byte_packets;
u64 rx_2048_to_4095_byte_packets;
u64 rx_4096_to_9216_byte_packets;
u64 rx_9217_to_16383_byte_packets;
u64 tx_1519_to_2047_byte_packets; u64 tx_1519_to_2047_byte_packets;
u64 tx_2048_to_4095_byte_packets; u64 tx_2048_to_4095_byte_packets;
u64 tx_4096_to_9216_byte_packets; u64 tx_4096_to_9216_byte_packets;
u64 tx_9217_to_16383_byte_packets; u64 tx_9217_to_16383_byte_packets;
u64 tx_pause_frames;
u64 tx_pfc_frames;
u64 tx_lpi_entry_count; u64 tx_lpi_entry_count;
u64 tx_total_collisions; u64 tx_total_collisions;
u64 brb_truncates; };
u64 brb_discards;
u64 tx_mac_ctrl_frames; struct qede_stats_ah {
u64 rx_1519_to_max_byte_packets;
u64 tx_1519_to_max_byte_packets;
};
struct qede_stats {
struct qede_stats_common common;
union {
struct qede_stats_bb bb;
struct qede_stats_ah ah;
};
}; };
struct qede_vlan { struct qede_vlan {
...@@ -158,6 +175,10 @@ struct qede_dev { ...@@ -158,6 +175,10 @@ struct qede_dev {
struct qed_dev_eth_info dev_info; struct qed_dev_eth_info dev_info;
#define QEDE_MAX_RSS_CNT(edev) ((edev)->dev_info.num_queues) #define QEDE_MAX_RSS_CNT(edev) ((edev)->dev_info.num_queues)
#define QEDE_MAX_TSS_CNT(edev) ((edev)->dev_info.num_queues) #define QEDE_MAX_TSS_CNT(edev) ((edev)->dev_info.num_queues)
#define QEDE_IS_BB(edev) \
((edev)->dev_info.common.dev_type == QED_DEV_TYPE_BB)
#define QEDE_IS_AH(edev) \
((edev)->dev_info.common.dev_type == QED_DEV_TYPE_AH)
struct qede_fastpath *fp_array; struct qede_fastpath *fp_array;
u8 req_num_tx; u8 req_num_tx;
......
...@@ -75,16 +75,33 @@ static const struct { ...@@ -75,16 +75,33 @@ static const struct {
QEDE_TQSTAT(stopped_cnt), QEDE_TQSTAT(stopped_cnt),
}; };
#define QEDE_STAT_OFFSET(stat_name) (offsetof(struct qede_stats, stat_name)) #define QEDE_STAT_OFFSET(stat_name, type, base) \
#define QEDE_STAT_STRING(stat_name) (#stat_name) (offsetof(type, stat_name) + (base))
#define _QEDE_STAT(stat_name, pf_only) \ #define QEDE_STAT_STRING(stat_name) (#stat_name)
{QEDE_STAT_OFFSET(stat_name), QEDE_STAT_STRING(stat_name), pf_only} #define _QEDE_STAT(stat_name, type, base, attr) \
#define QEDE_PF_STAT(stat_name) _QEDE_STAT(stat_name, true) {QEDE_STAT_OFFSET(stat_name, type, base), \
#define QEDE_STAT(stat_name) _QEDE_STAT(stat_name, false) QEDE_STAT_STRING(stat_name), \
attr}
#define QEDE_STAT(stat_name) \
_QEDE_STAT(stat_name, struct qede_stats_common, 0, 0x0)
#define QEDE_PF_STAT(stat_name) \
_QEDE_STAT(stat_name, struct qede_stats_common, 0, \
BIT(QEDE_STAT_PF_ONLY))
#define QEDE_PF_BB_STAT(stat_name) \
_QEDE_STAT(stat_name, struct qede_stats_bb, \
offsetof(struct qede_stats, bb), \
BIT(QEDE_STAT_PF_ONLY) | BIT(QEDE_STAT_BB_ONLY))
#define QEDE_PF_AH_STAT(stat_name) \
_QEDE_STAT(stat_name, struct qede_stats_ah, \
offsetof(struct qede_stats, ah), \
BIT(QEDE_STAT_PF_ONLY) | BIT(QEDE_STAT_AH_ONLY))
static const struct { static const struct {
u64 offset; u64 offset;
char string[ETH_GSTRING_LEN]; char string[ETH_GSTRING_LEN];
bool pf_only; unsigned long attr;
#define QEDE_STAT_PF_ONLY 0
#define QEDE_STAT_BB_ONLY 1
#define QEDE_STAT_AH_ONLY 2
} qede_stats_arr[] = { } qede_stats_arr[] = {
QEDE_STAT(rx_ucast_bytes), QEDE_STAT(rx_ucast_bytes),
QEDE_STAT(rx_mcast_bytes), QEDE_STAT(rx_mcast_bytes),
...@@ -106,22 +123,23 @@ static const struct { ...@@ -106,22 +123,23 @@ static const struct {
QEDE_PF_STAT(rx_256_to_511_byte_packets), QEDE_PF_STAT(rx_256_to_511_byte_packets),
QEDE_PF_STAT(rx_512_to_1023_byte_packets), QEDE_PF_STAT(rx_512_to_1023_byte_packets),
QEDE_PF_STAT(rx_1024_to_1518_byte_packets), QEDE_PF_STAT(rx_1024_to_1518_byte_packets),
QEDE_PF_STAT(rx_1519_to_1522_byte_packets), QEDE_PF_BB_STAT(rx_1519_to_1522_byte_packets),
QEDE_PF_STAT(rx_1519_to_2047_byte_packets), QEDE_PF_BB_STAT(rx_1519_to_2047_byte_packets),
QEDE_PF_STAT(rx_2048_to_4095_byte_packets), QEDE_PF_BB_STAT(rx_2048_to_4095_byte_packets),
QEDE_PF_STAT(rx_4096_to_9216_byte_packets), QEDE_PF_BB_STAT(rx_4096_to_9216_byte_packets),
QEDE_PF_STAT(rx_9217_to_16383_byte_packets), QEDE_PF_BB_STAT(rx_9217_to_16383_byte_packets),
QEDE_PF_AH_STAT(rx_1519_to_max_byte_packets),
QEDE_PF_STAT(tx_64_byte_packets), QEDE_PF_STAT(tx_64_byte_packets),
QEDE_PF_STAT(tx_65_to_127_byte_packets), QEDE_PF_STAT(tx_65_to_127_byte_packets),
QEDE_PF_STAT(tx_128_to_255_byte_packets), QEDE_PF_STAT(tx_128_to_255_byte_packets),
QEDE_PF_STAT(tx_256_to_511_byte_packets), QEDE_PF_STAT(tx_256_to_511_byte_packets),
QEDE_PF_STAT(tx_512_to_1023_byte_packets), QEDE_PF_STAT(tx_512_to_1023_byte_packets),
QEDE_PF_STAT(tx_1024_to_1518_byte_packets), QEDE_PF_STAT(tx_1024_to_1518_byte_packets),
QEDE_PF_STAT(tx_1519_to_2047_byte_packets), QEDE_PF_BB_STAT(tx_1519_to_2047_byte_packets),
QEDE_PF_STAT(tx_2048_to_4095_byte_packets), QEDE_PF_BB_STAT(tx_2048_to_4095_byte_packets),
QEDE_PF_STAT(tx_4096_to_9216_byte_packets), QEDE_PF_BB_STAT(tx_4096_to_9216_byte_packets),
QEDE_PF_STAT(tx_9217_to_16383_byte_packets), QEDE_PF_BB_STAT(tx_9217_to_16383_byte_packets),
QEDE_PF_AH_STAT(tx_1519_to_max_byte_packets),
QEDE_PF_STAT(rx_mac_crtl_frames), QEDE_PF_STAT(rx_mac_crtl_frames),
QEDE_PF_STAT(tx_mac_ctrl_frames), QEDE_PF_STAT(tx_mac_ctrl_frames),
QEDE_PF_STAT(rx_pause_frames), QEDE_PF_STAT(rx_pause_frames),
...@@ -136,8 +154,8 @@ static const struct { ...@@ -136,8 +154,8 @@ static const struct {
QEDE_PF_STAT(rx_jabbers), QEDE_PF_STAT(rx_jabbers),
QEDE_PF_STAT(rx_undersize_packets), QEDE_PF_STAT(rx_undersize_packets),
QEDE_PF_STAT(rx_fragments), QEDE_PF_STAT(rx_fragments),
QEDE_PF_STAT(tx_lpi_entry_count), QEDE_PF_BB_STAT(tx_lpi_entry_count),
QEDE_PF_STAT(tx_total_collisions), QEDE_PF_BB_STAT(tx_total_collisions),
QEDE_PF_STAT(brb_truncates), QEDE_PF_STAT(brb_truncates),
QEDE_PF_STAT(brb_discards), QEDE_PF_STAT(brb_discards),
QEDE_STAT(no_buff_discards), QEDE_STAT(no_buff_discards),
...@@ -155,6 +173,12 @@ static const struct { ...@@ -155,6 +173,12 @@ static const struct {
}; };
#define QEDE_NUM_STATS ARRAY_SIZE(qede_stats_arr) #define QEDE_NUM_STATS ARRAY_SIZE(qede_stats_arr)
#define QEDE_STAT_IS_PF_ONLY(i) \
test_bit(QEDE_STAT_PF_ONLY, &qede_stats_arr[i].attr)
#define QEDE_STAT_IS_BB_ONLY(i) \
test_bit(QEDE_STAT_BB_ONLY, &qede_stats_arr[i].attr)
#define QEDE_STAT_IS_AH_ONLY(i) \
test_bit(QEDE_STAT_AH_ONLY, &qede_stats_arr[i].attr)
enum { enum {
QEDE_PRI_FLAG_CMT, QEDE_PRI_FLAG_CMT,
...@@ -213,6 +237,13 @@ static void qede_get_strings_stats_rxq(struct qede_dev *edev, ...@@ -213,6 +237,13 @@ static void qede_get_strings_stats_rxq(struct qede_dev *edev,
} }
} }
static bool qede_is_irrelevant_stat(struct qede_dev *edev, int stat_index)
{
return (IS_VF(edev) && QEDE_STAT_IS_PF_ONLY(stat_index)) ||
(QEDE_IS_BB(edev) && QEDE_STAT_IS_AH_ONLY(stat_index)) ||
(QEDE_IS_AH(edev) && QEDE_STAT_IS_BB_ONLY(stat_index));
}
static void qede_get_strings_stats(struct qede_dev *edev, u8 *buf) static void qede_get_strings_stats(struct qede_dev *edev, u8 *buf)
{ {
struct qede_fastpath *fp; struct qede_fastpath *fp;
...@@ -234,7 +265,7 @@ static void qede_get_strings_stats(struct qede_dev *edev, u8 *buf) ...@@ -234,7 +265,7 @@ static void qede_get_strings_stats(struct qede_dev *edev, u8 *buf)
/* Account for non-queue statistics */ /* Account for non-queue statistics */
for (i = 0; i < QEDE_NUM_STATS; i++) { for (i = 0; i < QEDE_NUM_STATS; i++) {
if (IS_VF(edev) && qede_stats_arr[i].pf_only) if (qede_is_irrelevant_stat(edev, i))
continue; continue;
strcpy(buf, qede_stats_arr[i].string); strcpy(buf, qede_stats_arr[i].string);
buf += ETH_GSTRING_LEN; buf += ETH_GSTRING_LEN;
...@@ -309,7 +340,7 @@ static void qede_get_ethtool_stats(struct net_device *dev, ...@@ -309,7 +340,7 @@ static void qede_get_ethtool_stats(struct net_device *dev,
} }
for (i = 0; i < QEDE_NUM_STATS; i++) { for (i = 0; i < QEDE_NUM_STATS; i++) {
if (IS_VF(edev) && qede_stats_arr[i].pf_only) if (qede_is_irrelevant_stat(edev, i))
continue; continue;
*buf = *((u64 *)(((void *)&edev->stats) + *buf = *((u64 *)(((void *)&edev->stats) +
qede_stats_arr[i].offset)); qede_stats_arr[i].offset));
...@@ -323,17 +354,13 @@ static void qede_get_ethtool_stats(struct net_device *dev, ...@@ -323,17 +354,13 @@ static void qede_get_ethtool_stats(struct net_device *dev,
static int qede_get_sset_count(struct net_device *dev, int stringset) static int qede_get_sset_count(struct net_device *dev, int stringset)
{ {
struct qede_dev *edev = netdev_priv(dev); struct qede_dev *edev = netdev_priv(dev);
int num_stats = QEDE_NUM_STATS; int num_stats = QEDE_NUM_STATS, i;
switch (stringset) { switch (stringset) {
case ETH_SS_STATS: case ETH_SS_STATS:
if (IS_VF(edev)) { for (i = 0; i < QEDE_NUM_STATS; i++)
int i; if (qede_is_irrelevant_stat(edev, i))
num_stats--;
for (i = 0; i < QEDE_NUM_STATS; i++)
if (qede_stats_arr[i].pf_only)
num_stats--;
}
/* Account for the Regular Tx statistics */ /* Account for the Regular Tx statistics */
num_stats += QEDE_TSS_COUNT(edev) * QEDE_NUM_TQSTATS; num_stats += QEDE_TSS_COUNT(edev) * QEDE_NUM_TQSTATS;
......
...@@ -300,6 +300,11 @@ struct qed_sb_info { ...@@ -300,6 +300,11 @@ struct qed_sb_info {
struct qed_dev *cdev; struct qed_dev *cdev;
}; };
enum qed_dev_type {
QED_DEV_TYPE_BB,
QED_DEV_TYPE_AH,
};
struct qed_dev_info { struct qed_dev_info {
unsigned long pci_mem_start; unsigned long pci_mem_start;
unsigned long pci_mem_end; unsigned long pci_mem_end;
...@@ -325,6 +330,8 @@ struct qed_dev_info { ...@@ -325,6 +330,8 @@ struct qed_dev_info {
u16 mtu; u16 mtu;
bool wol_support; bool wol_support;
enum qed_dev_type dev_type;
}; };
enum qed_sb_type { enum qed_sb_type {
...@@ -752,7 +759,7 @@ enum qed_mf_mode { ...@@ -752,7 +759,7 @@ enum qed_mf_mode {
QED_MF_NPAR, QED_MF_NPAR,
}; };
struct qed_eth_stats { struct qed_eth_stats_common {
u64 no_buff_discards; u64 no_buff_discards;
u64 packet_too_big_discard; u64 packet_too_big_discard;
u64 ttl0_discard; u64 ttl0_discard;
...@@ -784,11 +791,6 @@ struct qed_eth_stats { ...@@ -784,11 +791,6 @@ struct qed_eth_stats {
u64 rx_256_to_511_byte_packets; u64 rx_256_to_511_byte_packets;
u64 rx_512_to_1023_byte_packets; u64 rx_512_to_1023_byte_packets;
u64 rx_1024_to_1518_byte_packets; u64 rx_1024_to_1518_byte_packets;
u64 rx_1519_to_1522_byte_packets;
u64 rx_1519_to_2047_byte_packets;
u64 rx_2048_to_4095_byte_packets;
u64 rx_4096_to_9216_byte_packets;
u64 rx_9217_to_16383_byte_packets;
u64 rx_crc_errors; u64 rx_crc_errors;
u64 rx_mac_crtl_frames; u64 rx_mac_crtl_frames;
u64 rx_pause_frames; u64 rx_pause_frames;
...@@ -805,14 +807,8 @@ struct qed_eth_stats { ...@@ -805,14 +807,8 @@ struct qed_eth_stats {
u64 tx_256_to_511_byte_packets; u64 tx_256_to_511_byte_packets;
u64 tx_512_to_1023_byte_packets; u64 tx_512_to_1023_byte_packets;
u64 tx_1024_to_1518_byte_packets; u64 tx_1024_to_1518_byte_packets;
u64 tx_1519_to_2047_byte_packets;
u64 tx_2048_to_4095_byte_packets;
u64 tx_4096_to_9216_byte_packets;
u64 tx_9217_to_16383_byte_packets;
u64 tx_pause_frames; u64 tx_pause_frames;
u64 tx_pfc_frames; u64 tx_pfc_frames;
u64 tx_lpi_entry_count;
u64 tx_total_collisions;
u64 brb_truncates; u64 brb_truncates;
u64 brb_discards; u64 brb_discards;
u64 rx_mac_bytes; u64 rx_mac_bytes;
...@@ -827,6 +823,34 @@ struct qed_eth_stats { ...@@ -827,6 +823,34 @@ struct qed_eth_stats {
u64 tx_mac_ctrl_frames; u64 tx_mac_ctrl_frames;
}; };
struct qed_eth_stats_bb {
u64 rx_1519_to_1522_byte_packets;
u64 rx_1519_to_2047_byte_packets;
u64 rx_2048_to_4095_byte_packets;
u64 rx_4096_to_9216_byte_packets;
u64 rx_9217_to_16383_byte_packets;
u64 tx_1519_to_2047_byte_packets;
u64 tx_2048_to_4095_byte_packets;
u64 tx_4096_to_9216_byte_packets;
u64 tx_9217_to_16383_byte_packets;
u64 tx_lpi_entry_count;
u64 tx_total_collisions;
};
struct qed_eth_stats_ah {
u64 rx_1519_to_max_byte_packets;
u64 tx_1519_to_max_byte_packets;
};
struct qed_eth_stats {
struct qed_eth_stats_common common;
union {
struct qed_eth_stats_bb bb;
struct qed_eth_stats_ah ah;
};
};
#define QED_SB_IDX 0x0002 #define QED_SB_IDX 0x0002
#define RX_PI 0 #define RX_PI 0
......
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
#define RDMA_MAX_PDS (64 * 1024) #define RDMA_MAX_PDS (64 * 1024)
#define RDMA_NUM_STATISTIC_COUNTERS MAX_NUM_VPORTS #define RDMA_NUM_STATISTIC_COUNTERS MAX_NUM_VPORTS
#define RDMA_NUM_STATISTIC_COUNTERS_BB MAX_NUM_VPORTS_BB #define RDMA_NUM_STATISTIC_COUNTERS_K2 MAX_NUM_VPORTS_K2
#define RDMA_NUM_STATISTIC_COUNTERS_BB MAX_NUM_VPORTS_BB
#define RDMA_TASK_TYPE (PROTOCOLID_ROCE) #define RDMA_TASK_TYPE (PROTOCOLID_ROCE)
......
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