Skip to contentSkip to conversation

bnx2x, cnic: support DRV_INFO upon FW request

PATCH Applied Michael Chan 3 participants 4 messages Dec 6, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 4/4 bnx2x, cnic: support DRV_INFO upon FW request

From: Barak Witkowski <[email protected]>

Add support to send driver capabilities, settings and statistics to management firmware.

[ Redone using many local variables, removed many unnecessary inlines,
and put #defines at the left margin suggested by Joe Perches ]

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h       |    4 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h   |  152 +++++++++++++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c  |  235 ++++++++++++++++++++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c |   20 ++-
 drivers/net/ethernet/broadcom/cnic.c              |   47 ++++
 drivers/net/ethernet/broadcom/cnic_if.h           |    9 +
 6 files changed, 459 insertions(+), 8 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +4 -0
index 40cfce0..8c73d34 100644
@@ -887,6 +887,8 @@ struct bnx2x_common {
 #define CHIP_PORT_MODE_NONE			0x2
 #define CHIP_MODE(bp)			(bp->common.chip_port_mode)
 #define CHIP_MODE_IS_4_PORT(bp) (CHIP_MODE(bp) == CHIP_4_PORT_MODE)
+
+	u32			boot_mode;
 };
 
 /* IGU MSIX STATISTICS on 57712: 64 for VFs; 4 for PFs; 4 for Attentions */
@@ -1048,6 +1050,8 @@ struct bnx2x_slowpath {
 
 	u32				wb_comp;
 	u32				wb_data[4];
+
+	union drv_info_to_mcp		drv_info_to_mcp;
 };
 
 #define bnx2x_sp(bp, var)		(&bp->slowpath->var)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +149 -3

182 lines not on this page · raw message

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +234 -1

271 lines not on this page · raw message

drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c +16 -4
index 41a33ce..c40e6b3 100644
@@ -39,6 +39,17 @@ static inline long bnx2x_hilo(u32 *hiref)
 #endif
 }
 
+static u16 bnx2x_get_port_stats_dma_len(struct bnx2x *bp)
+{
+	u16 res = sizeof(struct host_port_stats) >> 2;
+
+	/* if PFC stats are not supported by the MFW, don't DMA them */
+	if (!(bp->flags &  BC_SUPPORTS_PFC_STATS))
+		res -= (sizeof(u32)*4) >> 2;
+
+	return res;
+}
+
 /*
  * Init service functions
  */
@@ -178,7 +189,8 @@ static void bnx2x_stats_pmf_update(struct bnx2x *bp)
 				   DMAE_LEN32_RD_MAX * 4);
 	dmae->dst_addr_hi = U64_HI(bnx2x_sp_mapping(bp, port_stats) +
 				   DMAE_LEN32_RD_MAX * 4);
-	dmae->len = (sizeof(struct host_port_stats) >> 2) - DMAE_LEN32_RD_MAX;
+	dmae->len = bnx2x_get_port_stats_dma_len(bp) - DMAE_LEN32_RD_MAX;
+
 	dmae->comp_addr_lo = U64_LO(bnx2x_sp_mapping(bp, stats_comp));
 	dmae->comp_addr_hi = U64_HI(bnx2x_sp_mapping(bp, stats_comp));
 	dmae->comp_val = DMAE_COMP_VAL;
@@ -217,7 +229,7 @@ static void bnx2x_port_stats_init(struct bnx2x *bp)
 		dmae->src_addr_hi = U64_HI(bnx2x_sp_mapping(bp, port_stats));
 		dmae->dst_addr_lo = bp->port.port_stx >> 2;
 		dmae->dst_addr_hi = 0;
-		dmae->len = sizeof(struct host_port_stats) >> 2;
+		dmae->len = bnx2x_get_port_stats_dma_len(bp);
 		dmae->comp_addr_lo = dmae_reg_go_c[loader_idx] >> 2;
 		dmae->comp_addr_hi = 0;
 		dmae->comp_val = 1;
@@ -1307,7 +1319,7 @@ static void bnx2x_port_stats_stop(struct bnx2x *bp)
 		dmae->src_addr_hi = U64_HI(bnx2x_sp_mapping(bp, port_stats));
 		dmae->dst_addr_lo = bp->port.port_stx >> 2;
 		dmae->dst_addr_hi = 0;
-		dmae->len = sizeof(struct host_port_stats) >> 2;
+		dmae->len = bnx2x_get_port_stats_dma_len(bp);
 		if (bp->func_stx) {
 			dmae->comp_addr_lo = dmae_reg_go_c[loader_idx] >> 2;
 			dmae->comp_addr_hi = 0;
@@ -1424,7 +1436,7 @@ static void bnx2x_port_stats_base_init(struct bnx2x *bp)
 	dmae->src_addr_hi = U64_HI(bnx2x_sp_mapping(bp, port_stats));
 	dmae->dst_addr_lo = bp->port.port_stx >> 2;
 	dmae->dst_addr_hi = 0;
-	dmae->len = sizeof(struct host_port_stats) >> 2;
+	dmae->len = bnx2x_get_port_stats_dma_len(bp);
 	dmae->comp_addr_lo = U64_LO(bnx2x_sp_mapping(bp, stats_comp));
 	dmae->comp_addr_hi = U64_HI(bnx2x_sp_mapping(bp, stats_comp));
 	dmae->comp_val = DMAE_COMP_VAL;
drivers/net/ethernet/broadcom/cnic.c +47 -0

86 lines not on this page · raw message

drivers/net/ethernet/broadcom/cnic_if.h +9 -0
index 79443e0..d1f6456 100644
@@ -86,6 +86,8 @@ struct kcqe {
 #define CNIC_CTL_START_CMD		2
 #define CNIC_CTL_COMPLETION_CMD		3
 #define CNIC_CTL_STOP_ISCSI_CMD		4
+#define CNIC_CTL_FCOE_STATS_GET_CMD	5
+#define CNIC_CTL_ISCSI_STATS_GET_CMD	6
 
 #define DRV_CTL_IO_WR_CMD		0x101
 #define DRV_CTL_IO_RD_CMD		0x102
@@ -96,6 +98,8 @@ struct kcqe {
 #define DRV_CTL_STOP_L2_CMD		0x107
 #define DRV_CTL_RET_L2_SPQ_CREDIT_CMD	0x10c
 #define DRV_CTL_ISCSI_STOPPED_CMD	0x10d
+#define DRV_CTL_ULP_REGISTER_CMD	0x10e
+#define DRV_CTL_ULP_UNREGISTER_CMD	0x10f
 
 struct cnic_ctl_completion {
 	u32	cid;
@@ -133,6 +137,7 @@ struct drv_ctl_info {
 		struct drv_ctl_spq_credit credit;
 		struct drv_ctl_io io;
 		struct drv_ctl_l2_ring ring;
+		int ulp_type;
 		char bytes[MAX_DRV_CTL_DATA];
 	} data;
 };
@@ -201,6 +206,7 @@ struct cnic_eth_dev {
 					       struct kwqe_16 *[], u32);
 	int		(*drv_ctl)(struct net_device *, struct drv_ctl_info *);
 	unsigned long	reserved1[2];
+	union drv_info_to_mcp	*addr_drv_info_to_mcp;
 };
 
 struct cnic_sockaddr {
@@ -297,6 +303,8 @@ struct cnic_dev {
 	int		max_fcoe_conn;
 	int		max_rdma_conn;
 
+	union drv_info_to_mcp	*stats_addr;
+
 	void		*cnic_priv;
 };
 
@@ -326,6 +334,7 @@ struct cnic_ulp_ops {
 	void (*cm_remote_abort)(struct cnic_sock *);
 	int (*iscsi_nl_send_msg)(void *ulp_ctx, u32 msg_type,
 				  char *data, u16 data_size);
+	int (*cnic_get_stats)(void *ulp_ctx);
 	struct module *owner;
 	atomic_t ref_count;
 };
Signature · 1 line
1.7.1
maintainer Applied
#1 lore raw

From: "Michael Chan" <[email protected]>
Date: Tue, 6 Dec 2011 00:41:50 -0800

Quoted 5 lines

From: Barak Witkowski <[email protected]>

Add support to send driver capabilities, settings and statistics to management firmware.

Quoted 7 lines

[ Redone using many local variables, removed many unnecessary inlines,
and put #defines at the left margin suggested by Joe Perches ]

Applied.

#2 lore raw
Quoted 11 lines · David Miller

From: "Michael Chan" <[email protected]>
Date: Tue, 6 Dec 2011 00:41:50 -0800

Quoted 8 lines

From: Barak Witkowski <[email protected]>

Add support to send driver capabilities, settings and statistics to management firmware.

[ Redone using many local variables, removed many unnecessary inlines,
and put #defines at the left margin suggested by Joe Perches ]

Quoted 6 lines
Quoted 4 lines

Applied.

Build error here if :

# grep CNIC .config
# CONFIG_CNIC is not set
# CONFIG_QLCNIC is not set

CC [M] drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.o
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c: In function ‘bnx2x_drv_info_fcoe_stat’:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:2950:33: erreur:
‘struct bnx2x’ has no member named ‘fip_mac’ drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c: In function ‘bnx2x_drv_info_iscsi_stat’:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:3041:34: erreur:
‘struct bnx2x’ has no member named ‘cnic_eth_dev’

#3 lore raw
Quoted 7 lines · Eric Dumazet

Build error here if :

# grep CNIC .config
# CONFIG_CNIC is not set
# CONFIG_QLCNIC is not set
Quoted 10 lines

CC [M] drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.o
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c: In function ‘bnx2x_drv_info_fcoe_stat’:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:2950:33: erreur:
‘struct bnx2x’ has no member named ‘fip_mac’ drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c: In function ‘bnx2x_drv_info_iscsi_stat’:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:3041:34: erreur:
‘struct bnx2x’ has no member named ‘cnic_eth_dev’

Thanks for reporting this. I'll send a patch to fix this shortly.