cnic: Fix Context ID space calculation
Subsystems (5)
PATCH 1/4 cnic: Fix Context ID space calculation
Include FCoE CID space only for E2_PLUS devices. Remove old CID offset adjustments that are no longer needed.
--- drivers/net/cnic.c | 10 +--------- 1 files changed, 1 insertions(+), 9 deletions(-)
drivers/net/cnic.c +1 -9
@@ -1172,7 +1172,7 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) cp->iro_arr = ethdev->iro_arr; - cp->max_cid_space =MAX_ISCSI_TBL_SZ +BNX2X_FCOE_NUM_CONNECTIONS ; + cp->max_cid_space =MAX_ISCSI_TBL_SZ ; cp->iscsi_start_cid = start_cid; cp->fcoe_start_cid = start_cid +MAX_ISCSI_TBL_SZ ;
@@ -1183,14 +1183,6 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) cp->fcoe_init_cid =0x10 ; } -if (start_cid <BNX2X_ISCSI_START_CID ) { -u32 delta =BNX2X_ISCSI_START_CID - start_cid; - - cp->iscsi_start_cid =BNX2X_ISCSI_START_CID ; - cp->fcoe_start_cid += delta; - cp->max_cid_space += delta; - } - cp->iscsi_tbl =kzalloc (sizeof (struct cnic_iscsi ) *MAX_ISCSI_TBL_SZ ,GFP_KERNEL );if (!cp->iscsi_tbl)
Signature · 1 line
1.6.4.GIT
PATCH 2/4 cnic: Wait for all Context IDs to be deleted before sending FCOE_DESTROY_FUNC
Otherwise, the firmware will not respond and we'll have to wait for timeout. Refactor the wait loop we already have into a separate function for this purpose.
--- drivers/net/cnic.c | 45 +++++++++++++++++++++++++++------------------ 1 files changed, 27 insertions(+), 18 deletions(-)
drivers/net/cnic.c +27 -18
@@ -2448,6 +2448,30 @@ static int cnic_bnx2x_fcoe_destroy(struct cnic_dev *dev, struct kwqe *kwqe)return ret; } +static void cnic_bnx2x_delete_wait (struct cnic_dev *dev,u32 start_cid) +{ +struct cnic_local *cp = dev->cnic_priv; +u32 i; + +for (i = start_cid; i < cp->max_cid_space; i++) { +struct cnic_context *ctx = &cp->ctx_tbl[i]; +int j; + +while (test_bit (CTX_FL_DELETE_WAIT , &ctx->ctx_flags)) +msleep (10 ); + +for (j =0 ; j <5 ; j++) { +if (!test_bit (CTX_FL_OFFLD_START , &ctx->ctx_flags)) +break ; +msleep (20 ); + } + +if (test_bit (CTX_FL_OFFLD_START , &ctx->ctx_flags)) +netdev_warn (dev->netdev,"CID %x not deleted\n" , + ctx->cid); + } +} +static int cnic_bnx2x_fcoe_fw_destroy (struct cnic_dev *dev,struct kwqe *kwqe) {struct fcoe_kwqe_destroy *req;
@@ -2456,6 +2480,8 @@ static int cnic_bnx2x_fcoe_fw_destroy(struct cnic_dev *dev, struct kwqe *kwqe)int ret;u32 cid; +cnic_bnx2x_delete_wait (dev,MAX_ISCSI_TBL_SZ ); + req = (struct fcoe_kwqe_destroy *) kwqe; cid =BNX2X_HW_CID (cp, cp->fcoe_init_cid);
@@ -3930,7 +3956,6 @@ static void cnic_close_bnx2x_conn(struct cnic_sock *csk, u32 opcode)static void cnic_cm_stop_bnx2x_hw (struct cnic_dev *dev) {struct cnic_local *cp = dev->cnic_priv; -int i;if (!cp->ctx_tbl)return ;
@@ -3938,23 +3963,7 @@ static void cnic_cm_stop_bnx2x_hw(struct cnic_dev *dev)if (!netif_running (dev->netdev))return ; -for (i =0 ; i < cp->max_cid_space; i++) { -struct cnic_context *ctx = &cp->ctx_tbl[i]; -int j; - -while (test_bit (CTX_FL_DELETE_WAIT , &ctx->ctx_flags)) -msleep (10 ); - -for (j =0 ; j <5 ; j++) { -if (!test_bit (CTX_FL_OFFLD_START , &ctx->ctx_flags)) -break ; -msleep (20 ); - } - -if (test_bit (CTX_FL_OFFLD_START , &ctx->ctx_flags)) -netdev_warn (dev->netdev,"CID %x not deleted\n" , - ctx->cid); - } +cnic_bnx2x_delete_wait (dev,0 );cancel_delayed_work (&cp->delete_task);flush_workqueue (cnic_wq);
Signature · 1 line
1.6.4.GIT
PATCH 3/4 cnic: Add VLAN ID as a parameter during netevent upcall
The bnx2fc driver needs to handle netdev events on VLAN devices.
--- drivers/net/cnic.c | 50 +++++++++++++++++++++++++----------- drivers/net/cnic_if.h | 6 ++-- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 8 +++++- drivers/scsi/bnx2i/bnx2i_hwi.c | 8 +++++- 4 files changed, 52 insertions(+), 20 deletions(-)
drivers/net/cnic.c +35 -15
@@ -5334,6 +5334,27 @@ static struct cnic_dev *is_cnic_dev(struct net_device *dev)return cdev; } +static void cnic_rcv_netevent (struct cnic_local *cp,unsigned long event, +u16 vlan_id) +{ +int if_type; + +rcu_read_lock (); +for (if_type =0 ; if_type <MAX_CNIC_ULP_TYPE ; if_type++) { +struct cnic_ulp_ops *ulp_ops; +void *ctx; + + ulp_ops =rcu_dereference (cp->ulp_ops[if_type]); +if (!ulp_ops || !ulp_ops->indicate_netevent) +continue ; + + ctx = cp->ulp_handle[if_type]; + + ulp_ops->indicate_netevent (ctx, event, vlan_id); + } +rcu_read_unlock (); +} +/** * netdev event handler */
@@ -5342,7 +5363,6 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event, {struct net_device *netdev = ptr;struct cnic_dev *dev; -int if_type;int new_dev =0 ; dev =cnic_from_netdev (netdev);
@@ -5372,20 +5392,7 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,cnic_ulp_start (dev); } -rcu_read_lock (); -for (if_type =0 ; if_type <MAX_CNIC_ULP_TYPE ; if_type++) { -struct cnic_ulp_ops *ulp_ops; -void *ctx; - - ulp_ops =rcu_dereference (cp->ulp_ops[if_type]); -if (!ulp_ops || !ulp_ops->indicate_netevent) -continue ; - - ctx = cp->ulp_handle[if_type]; - - ulp_ops->indicate_netevent (ctx, event); - } -rcu_read_unlock (); +cnic_rcv_netevent (cp, event,0 );if (event ==NETDEV_GOING_DOWN ) {cnic_ulp_stop (dev);
@@ -5401,6 +5408,19 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event, goto done; }cnic_put (dev); + }else { +struct net_device *realdev; +u16 vid; + + vid =cnic_get_vlan (netdev, &realdev); +if (realdev) { + dev =cnic_from_netdev (realdev); +if (dev) { + vid |=VLAN_TAG_PRESENT ; +cnic_rcv_netevent (dev->cnic_priv, event, vid); +cnic_put (dev); + } + } } done:return NOTIFY_DONE ;
drivers/net/cnic_if.h +3 -3
@@ -12,8 +12,8 @@#ifndef CNIC_IF_H #define CNIC_IF_H -#define CNIC_MODULE_VERSION "2.5.6" -#define CNIC_MODULE_RELDATE "July 12, 2011" +#define CNIC_MODULE_VERSION "2.5.7" +#define CNIC_MODULE_RELDATE "July 20, 2011"#define CNIC_ULP_RDMA 0#define CNIC_ULP_ISCSI 1
@@ -313,7 +313,7 @@ struct cnic_ulp_ops {void (*cnic_stop)(void *ulp_ctx);void (*indicate_kcqes)(void *ulp_ctx,struct kcqe *cqes[],u32 num_cqes); -void (*indicate_netevent)(void *ulp_ctx,unsigned long event); +void (*indicate_netevent)(void *ulp_ctx,unsigned long event,u16 vid);void (*cm_connect_complete)(struct cnic_sock *);void (*cm_close_complete)(struct cnic_sock *);void (*cm_abort_complete)(struct cnic_sock *);
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +7 -1
@@ -767,17 +767,23 @@ static void bnx2fc_destroy_timer(unsigned long data)* * @context: adapter structure pointer * @event: event type +* @vlan_id: vlan id - associated vlan id with this event * * Handles NETDEV_UP, NETDEV_DOWN, NETDEV_GOING_DOWN,NETDEV_CHANGE and * NETDEV_CHANGE_MTU events */ -static void bnx2fc_indicate_netevent (void *context,unsigned long event) +static void bnx2fc_indicate_netevent (void *context,unsigned long event, +u16 vlan_id) {struct bnx2fc_hba *hba = (struct bnx2fc_hba *)context;struct fc_lport *lport = hba->ctlr.lp;struct fc_lport *vport;u32 link_possible =1 ; +/* Ignore vlans for now */ +if (vlan_id !=0 ) +return ; +if (!test_bit (BNX2FC_CREATE_DONE , &hba->init_done)) {BNX2FC_MISC_DBG ("driver not ready. event=%s %ld\n" , hba->netdev->name, event);
drivers/scsi/bnx2i/bnx2i_hwi.c +7 -1
@@ -2386,14 +2386,20 @@ static void bnx2i_indicate_kcqe(void *context, struct kcqe *kcqe[],* bnx2i_indicate_netevent - Generic netdev event handler * @context: adapter structure pointer * @event: event type +* @vlan_id: vlans id - associated vlan id with this event * * Handles four netdev events, NETDEV_UP, NETDEV_DOWN, * NETDEV_GOING_DOWN and NETDEV_CHANGE */ -static void bnx2i_indicate_netevent (void *context,unsigned long event) +static void bnx2i_indicate_netevent (void *context,unsigned long event, +u16 vlan_id) {struct bnx2i_hba *hba = context; +/* Ignore all netevent coming from vlans */ +if (vlan_id !=0 ) +return ; +switch (event) {case NETDEV_UP :if (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state))
Signature · 1 line
1.6.4.GIT
PATCH 4/4 bnx2: Fix endian swapping on firmware version string
so that ethtool -i will display it correctly on big endian systems.
--- drivers/net/bnx2.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/bnx2.c +3 -3
@@ -56,8 +56,8 @@#include "bnx2_fw.h" #define DRV_MODULE_NAME "bnx2" -#define DRV_MODULE_VERSION "2.1.10" -#define DRV_MODULE_RELDATE "July 12, 2011" +#define DRV_MODULE_VERSION "2.1.11" +#define DRV_MODULE_RELDATE "July 20, 2011"#define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-6.2.1.fw"#define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-6.0.15.fw"#define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-6.2.1a.fw"
@@ -8097,7 +8097,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) bp->fw_version[j++] =' ' ;for (i =0 ; i <3 && j <28 ; i++) { reg =bnx2_reg_rd_ind (bp, addr + i *4 ); - reg =swab32 (reg); + reg =be32_to_cpu (reg);memcpy (&bp->fw_version[j], ®,4 ); j +=4 ; }
Signature · 1 line
1.6.4.GIT
Re: [PATCH 4/4 net-next] bnx2: Fix endian swapping on firmware version string
From: "Michael Chan" <[email protected]>
Date: Wed, 20 Jul 2011 17:55:25 -0700
Quoted 4 lines
so that ethtool -i will display it correctly on big endian systems.
Signed-off-by Michael Chan <[email protected]>Reviewed-by Bhanu Prakash Gollapudi <[email protected]>
Applied.
Re: [PATCH 3/4 net-next] cnic: Add VLAN ID as a parameter during netevent upcall
In reply to Michael ChanFrom: "Michael Chan" <[email protected]>
Date: Wed, 20 Jul 2011 17:55:24 -0700
Quoted 4 lines
The bnx2fc driver needs to handle netdev events on VLAN devices.
Signed-off-by Michael Chan <[email protected]>Reviewed-by Bhanu Prakash Gollapudi <[email protected]>
Applied.
Re: [PATCH 2/4 net-next] cnic: Wait for all Context IDs to be deleted before sending FCOE_DESTROY_FUNC
In reply to Michael ChanFrom: "Michael Chan" <[email protected]>
Date: Wed, 20 Jul 2011 17:55:23 -0700
Quoted 6 lines
Otherwise, the firmware will not respond and we'll have to wait for timeout. Refactor the wait loop we already have into a separate function for this purpose.
Signed-off-by Michael Chan <[email protected]>Reviewed-by Bhanu Prakash Gollapudi <[email protected]>
Applied.
From: "Michael Chan" <[email protected]>
Date: Wed, 20 Jul 2011 17:55:22 -0700
Quoted 5 lines
Include FCoE CID space only for
E2_PLUSdevices. Remove old CID offset adjustments that are no longer needed.Signed-off-by Michael Chan <[email protected]>Reviewed-by Bhanu Prakash Gollapudi <[email protected]>
Applied.