Skip to contentSkip to conversation

bnx2x: dont handle storage drv_info req if no cnic

PATCH Applied Barak Witkowski 4 participants 8 messages Dec 7, 2011 – Dec 14, 2011 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): Barak Witkowski <[email protected]

#1 lore raw

PATCH 1/2 bnx2x: dont handle storage drv_info req if no cnic

This patch returns ACK with zeroed buffer to FW upon fcoe/iscsi drv_info request if cnic is not defined. This is better handling in comparison to send NACK to FW upon such request, as it's a valid request.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +8 -4
index 418e7d3..d104695 100644
@@ -2941,9 +2941,9 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x *bp)
 	ether_stat->rxq_size = bp->rx_ring_size;
 }
 
+#ifdef BCM_CNIC
 static void bnx2x_drv_info_fcoe_stat(struct bnx2x *bp)
 {
-#ifdef BCM_CNIC
 	struct bnx2x_dcbx_app_params *app = &bp->dcbx_port_params.app;
 	struct fcoe_stats_info *fcoe_stat =
 		&bp->slowpath->drv_info_to_mcp.fcoe_stat;
@@ -3029,12 +3029,12 @@ static void bnx2x_drv_info_fcoe_stat(struct bnx2x *bp)
 
 	/* ask L5 driver to add data to the struct */
 	bnx2x_cnic_notify(bp, CNIC_CTL_FCOE_STATS_GET_CMD);
-#endif
 }
+#endif
 
+#ifdef BCM_CNIC
 static void bnx2x_drv_info_iscsi_stat(struct bnx2x *bp)
 {
-#ifdef BCM_CNIC
 	struct bnx2x_dcbx_app_params *app = &bp->dcbx_port_params.app;
 	struct iscsi_stats_info *iscsi_stat =
 		&bp->slowpath->drv_info_to_mcp.iscsi_stat;
@@ -3046,8 +3046,8 @@ static void bnx2x_drv_info_iscsi_stat(struct bnx2x *bp)
 
 	/* ask L5 driver to add data to the struct */
 	bnx2x_cnic_notify(bp, CNIC_CTL_ISCSI_STATS_GET_CMD);
-#endif
 }
+#endif
 
 /* called due to MCP event (on pmf):
  *	reread new bandwidth configuration
@@ -3091,10 +3091,14 @@ static void bnx2x_handle_drv_info_req(struct bnx2x *bp)
 		bnx2x_drv_info_ether_stat(bp);
 		break;
 	case FCOE_STATS_OPCODE:
+#ifdef BCM_CNIC
 		bnx2x_drv_info_fcoe_stat(bp);
+#endif
 		break;
 	case ISCSI_STATS_OPCODE:
+#ifdef BCM_CNIC
 		bnx2x_drv_info_iscsi_stat(bp);
+#endif
 		break;
 	default:
 		/* if op code isn't supported - send NACK */
Signature · 1 line
1.7.7.4
#2 lore raw

PATCH 2/2 bnx2x: fix typo in fcoe stats collection

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +1 -1
index d104695..12b8001 100644
@@ -2994,7 +2994,7 @@ static void bnx2x_drv_info_fcoe_stat(struct bnx2x *bp)
 		       fcoe_q_tstorm_stats->rcv_bcast_pkts);
 
 		ADD_64(fcoe_stat->rx_frames_hi, 0, fcoe_stat->rx_frames_lo,
-		       fcoe_q_tstorm_stats->rcv_ucast_pkts);
+		       fcoe_q_tstorm_stats->rcv_mcast_pkts);
 
 		ADD_64(fcoe_stat->tx_bytes_hi, 0, fcoe_stat->tx_bytes_lo,
 		       fw_fcoe_stat->tx_stat.fcoe_tx_byte_cnt);
Signature · 1 line
1.7.7.4
#4 lore raw

[BUG] bnx2x: crash at boot

Hi guys

Latest net-next crashes in bnx2x_stats_init+0x678/0xc90
CR2: 000000000000000004da

# CONFIG_SCSI_BNX2X_FCOE is not set

Oh well...

bnx2x_nic_init()
bnx2x_nic_load()
bnx2x_open()
dev_change_flags()

FCOE support is good, but could we get back Ethernet support ?

#5 lore raw
In reply to Barak Witkowski
Quoted 3 lines · Barak Witkowski

This patch returns ACK with zeroed buffer to FW upon fcoe/iscsi drv_info request if cnic is not defined. This is better handling in comparison to send NACK to FW upon such request, as it's a valid request.

Hi Barak.

Other than the good comment, I think this patch isn't useful. It adds maintenance overhead.

It just adds more #ifdefs.

gcc should remove the call to the empty static void funcs.

Quoted 62 lines
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +8 -4
index 418e7d3..d104695 100644
@@ -2941,9 +2941,9 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x *bp)
 	ether_stat->rxq_size = bp->rx_ring_size;
 }
 
+#ifdef BCM_CNIC
 static void bnx2x_drv_info_fcoe_stat(struct bnx2x *bp)
 {
-#ifdef BCM_CNIC
 	struct bnx2x_dcbx_app_params *app = &bp->dcbx_port_params.app;
 	struct fcoe_stats_info *fcoe_stat =
 		&bp->slowpath->drv_info_to_mcp.fcoe_stat;
@@ -3029,12 +3029,12 @@ static void bnx2x_drv_info_fcoe_stat(struct bnx2x *bp)
 
 	/* ask L5 driver to add data to the struct */
 	bnx2x_cnic_notify(bp, CNIC_CTL_FCOE_STATS_GET_CMD);
-#endif
 }
+#endif
 
+#ifdef BCM_CNIC
 static void bnx2x_drv_info_iscsi_stat(struct bnx2x *bp)
 {
-#ifdef BCM_CNIC
 	struct bnx2x_dcbx_app_params *app = &bp->dcbx_port_params.app;
 	struct iscsi_stats_info *iscsi_stat =
 		&bp->slowpath->drv_info_to_mcp.iscsi_stat;
@@ -3046,8 +3046,8 @@ static void bnx2x_drv_info_iscsi_stat(struct bnx2x *bp)
 
 	/* ask L5 driver to add data to the struct */
 	bnx2x_cnic_notify(bp, CNIC_CTL_ISCSI_STATS_GET_CMD);
-#endif
 }
+#endif
 
 /* called due to MCP event (on pmf):
  *	reread new bandwidth configuration
@@ -3091,10 +3091,14 @@ static void bnx2x_handle_drv_info_req(struct bnx2x *bp)
 		bnx2x_drv_info_ether_stat(bp);
 		break;
 	case FCOE_STATS_OPCODE:
+#ifdef BCM_CNIC
 		bnx2x_drv_info_fcoe_stat(bp);
+#endif
 		break;
 	case ISCSI_STATS_OPCODE:
+#ifdef BCM_CNIC
 		bnx2x_drv_info_iscsi_stat(bp);
+#endif
 		break;
 	default:
 		/* if op code isn't supported - send NACK */
maintainer
#6 lore raw

From: Joe Perches <[email protected]>
Date: Wed, 07 Dec 2011 09:04:00 -0800

Quoted 7 lines · Barak Witkowski
Quoted 3 lines

This patch returns ACK with zeroed buffer to FW upon fcoe/iscsi drv_info request if cnic is not defined. This is better handling in comparison to send NACK to FW upon such request, as it's a valid request.

Hi Barak.

Quoted 8 lines

Other than the good comment, I think this patch isn't useful. It adds maintenance overhead.

It just adds more #ifdefs.

gcc should remove the call to the empty static void funcs.

Agreed, I'm not applying this patch.

#7 lore raw

PATCH 1/1 bnx2x: handle vpd data longer than 128 bytes

In reply to a message not in the archive
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   35 +++++++++++++++++----
 1 files changed, 28 insertions(+), 7 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +28 -7
index b45baf9..ffeaaa9 100644
@@ -9931,30 +9931,49 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp)
 static void __devinit bnx2x_read_fwinfo(struct bnx2x *bp)
 {
 	int cnt, i, block_end, rodi;
-	char vpd_data[BNX2X_VPD_LEN+1];
+	char vpd_start[BNX2X_VPD_LEN+1];
 	char str_id_reg[VENDOR_ID_LEN+1];
 	char str_id_cap[VENDOR_ID_LEN+1];
+	char *vpd_data;
+	char *vpd_extended_data = NULL;
 	u8 len;
 
-	cnt = pci_read_vpd(bp->pdev, 0, BNX2X_VPD_LEN, vpd_data);
+	cnt = pci_read_vpd(bp->pdev, 0, BNX2X_VPD_LEN, vpd_start);
 	memset(bp->fw_ver, 0, sizeof(bp->fw_ver));
 
 	if (cnt < BNX2X_VPD_LEN)
 		goto out_not_found;
 
-	i = pci_vpd_find_tag(vpd_data, 0, BNX2X_VPD_LEN,
+	/* VPD RO tag should be first tag after identifier string, hence
+	 * we should be able to find it in first BNX2X_VPD_LEN chars
+	 */
+	i = pci_vpd_find_tag(vpd_start, 0, BNX2X_VPD_LEN,
 			     PCI_VPD_LRDT_RO_DATA);
 	if (i < 0)
 		goto out_not_found;
 
-
 	block_end = i + PCI_VPD_LRDT_TAG_SIZE +
-		    pci_vpd_lrdt_size(&vpd_data[i]);
+		    pci_vpd_lrdt_size(&vpd_start[i]);
 
 	i += PCI_VPD_LRDT_TAG_SIZE;
 
-	if (block_end > BNX2X_VPD_LEN)
-		goto out_not_found;
+	if (block_end > BNX2X_VPD_LEN) {
+		vpd_extended_data = kmalloc(block_end, GFP_KERNEL);
+		if (vpd_extended_data  == NULL)
+			goto out_not_found;
+
+		/* read rest of vpd image into vpd_extended_data */
+		memcpy(vpd_extended_data, vpd_start, BNX2X_VPD_LEN);
+		cnt = pci_read_vpd(bp->pdev, BNX2X_VPD_LEN,
+				   block_end - BNX2X_VPD_LEN,
+				   vpd_extended_data + BNX2X_VPD_LEN);
+		if (cnt < (block_end - BNX2X_VPD_LEN))
+			goto out_not_found;
+		vpd_data = vpd_extended_data;
+	} else
+		vpd_data = vpd_start;
+
+	/* now vpd_data holds full vpd content in both cases */
 
 	rodi = pci_vpd_find_info_keyword(vpd_data, i, block_end,
 				   PCI_VPD_RO_KEYWORD_MFR_ID);
@@ -9986,9 +10005,11 @@ static void __devinit bnx2x_read_fwinfo(struct bnx2x *bp)
 				bp->fw_ver[len] = ' ';
 			}
 		}
+		kfree(vpd_extended_data);
 		return;
 	}
 out_not_found:
+	kfree(vpd_extended_data);
 	return;
 }
 
Signature · 1 line
1.7.7.4