cnic: Simplify netdev events handling.
PATCH 1/6 cnic: Simplify netdev events handling.
After this earlier commit to simplify probing:
commit 4bd9b0fffb193d2e288f67f81821af32df8d4349 cnic, bnx2x, bnx2: Simplify cnic probing.
we can now reliably receive netdev events and we can simplify the handling of these events. We now remove the logic that tries to handle missed NETDEV_REGISTER events.
This change will allow cleanup to be simplified in the next patch. We can now rely on the play back of netdev events during unregister_netdevice_notifier() to cleanup the structures.
--- drivers/net/ethernet/broadcom/cnic.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/cnic.c +2 -2
@@ -5628,7 +5628,7 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event, dev =cnic_from_netdev (netdev); -if (!dev && (event ==NETDEV_REGISTER ||netif_running (netdev))) { +if (!dev && event ==NETDEV_REGISTER ) {/* Check for the hot-plug device */ dev =is_cnic_dev (netdev);if (dev) {
@@ -5644,7 +5644,7 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,else if (event ==NETDEV_UNREGISTER )cnic_ulp_exit (dev); -if (event ==NETDEV_UP || (new_dev &&netif_running (netdev))) { +if (event ==NETDEV_UP ) {if (cnic_register_netdev (dev) !=0 ) {cnic_put (dev); goto done;
Signature · 1 line
1.7.1
PATCH 2/6 cnic: Simplify cnic_release().
Since unregister_netdevice_notifier() will replay the NETDEV_DOWN and NETDEV_UNREGISTER_EVENTS, the cnic_dev_list will be cleaned up automatically. The loop to cleanup the cnic_dev_list can be removed in cnic_release().
--- drivers/net/ethernet/broadcom/cnic.c | 13 ------------- 1 files changed, 0 insertions(+), 13 deletions(-)
drivers/net/ethernet/broadcom/cnic.c +0 -13
@@ -5693,21 +5693,8 @@ static struct notifier_block cnic_netdev_notifier = {static void cnic_release (void ) { -struct cnic_dev *dev;struct cnic_uio_dev *udev; -while (!list_empty (&cnic_dev_list)) { - dev = list_entry(cnic_dev_list.next, struct cnic_dev, list); -if (test_bit (CNIC_F_CNIC_UP , &dev->flags)) { -cnic_ulp_stop (dev); -cnic_stop_hw (dev); - } - -cnic_ulp_exit (dev); -cnic_unregister_netdev (dev); -list_del_init (&dev->list); -cnic_free_dev (dev); - }while (!list_empty (&cnic_udev_list)) { udev = list_entry(cnic_udev_list.next, struct cnic_uio_dev, list);
Signature · 1 line
1.7.1
PATCH 3/6 cnic: Reset tcp_flags during cnic_cm_create().
From: Eddie Wai <[email protected]>
Without resetting it, the bnx2i driver cannot use different options for different iSCSI connections.
--- drivers/net/ethernet/broadcom/cnic.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/ethernet/broadcom/cnic.c +1 -0
@@ -3603,6 +3603,7 @@ static int cnic_cm_create(struct cnic_dev *dev, int ulp_type, u32 cid, csk1->rcv_buf =DEF_RCV_BUF ; csk1->snd_buf =DEF_SND_BUF ; csk1->seed =DEF_SEED ; + csk1->tcp_flags =0 ; *csk = csk1;return 0 ;
Signature · 1 line
1.7.1
PATCH 4/6 cnic: Update TCP options setup for iSCSI.
From: Eddie Wai <[email protected]>
Update TCP delayed ACK and timestamp options setup to match latest bnx2x firmware.
--- drivers/net/ethernet/broadcom/cnic.c | 53 +++++++++++++++-------------- drivers/net/ethernet/broadcom/cnic_defs.h | 4 +- drivers/scsi/bnx2i/57xx_iscsi_hsi.h | 12 ++++-- 3 files changed, 37 insertions(+), 32 deletions(-)
drivers/net/ethernet/broadcom/cnic.c +27 -26
@@ -1427,6 +1427,28 @@ static void cnic_reply_bnx2x_kcqes(struct cnic_dev *dev, int ulp_type,rcu_read_unlock (); } +static void cnic_bnx2x_set_tcp_options (struct cnic_dev *dev,int time_stamps, +int en_tcp_dack) +{ +struct cnic_local *cp = dev->cnic_priv; +struct bnx2x *bp =netdev_priv (dev->netdev); +u8 xstorm_flags =XSTORM_L5CM_TCP_FLAGS_WND_SCL_EN ; +u16 tstorm_flags =0 ; + +if (time_stamps) { + xstorm_flags |=XSTORM_L5CM_TCP_FLAGS_TS_ENABLED ; + tstorm_flags |=TSTORM_L5CM_TCP_FLAGS_TS_ENABLED ; + } +if (en_tcp_dack) + tstorm_flags |=TSTORM_L5CM_TCP_FLAGS_DELAYED_ACK_EN ; + +CNIC_WR8 (dev,BAR_XSTRORM_INTMEM + +XSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET (cp->pfid), xstorm_flags); + +CNIC_WR16 (dev,BAR_TSTRORM_INTMEM + +TSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET (cp->pfid), tstorm_flags); +} +static int cnic_bnx2x_iscsi_init1 (struct cnic_dev *dev,struct kwqe *kwqe) {struct cnic_local *cp = dev->cnic_priv;
@@ -1506,6 +1528,10 @@ static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe)CNIC_WR16 (dev,BAR_CSTRORM_INTMEM +CSTORM_ISCSI_HQ_SIZE_OFFSET (pfid), hq_bds); +cnic_bnx2x_set_tcp_options (dev, + req1->flags &ISCSI_KWQE_INIT1_TIME_STAMPS_ENABLE , + req1->flags &ISCSI_KWQE_INIT1_DELAYED_ACK_ENABLE ); +return 0 ; }
@@ -2035,9 +2061,6 @@ static void cnic_init_storm_conn_bufs(struct cnic_dev *dev, xstorm_buf->pseudo_header_checksum =swab16 (~csum_ipv6_magic (&src_ip, &dst_ip,0 ,IPPROTO_TCP ,0 )); -if (!(kwqe1->tcp_flags &L4_KWQ_CONNECT_REQ1_NO_DELAY_ACK )) - tstorm_buf->params |= -L5CM_TSTORM_CONN_BUFFER_DELAYED_ACK_ENABLE ;if (kwqe3->ka_timeout) { tstorm_buf->ka_enable =1 ; tstorm_buf->ka_timeout = kwqe3->ka_timeout;
@@ -2084,25 +2107,6 @@ static void cnic_init_bnx2x_mac(struct cnic_dev *dev) mac[0]); } -static void cnic_bnx2x_set_tcp_timestamp (struct cnic_dev *dev,int tcp_ts) -{ -struct cnic_local *cp = dev->cnic_priv; -struct bnx2x *bp =netdev_priv (dev->netdev); -u8 xstorm_flags =XSTORM_L5CM_TCP_FLAGS_WND_SCL_EN ; -u16 tstorm_flags =0 ; - -if (tcp_ts) { - xstorm_flags |=XSTORM_L5CM_TCP_FLAGS_TS_ENABLED ; - tstorm_flags |=TSTORM_L5CM_TCP_FLAGS_TS_ENABLED ; - } - -CNIC_WR8 (dev,BAR_XSTRORM_INTMEM + -XSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET (cp->pfid), xstorm_flags); - -CNIC_WR16 (dev,BAR_TSTRORM_INTMEM + -TSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET (cp->pfid), tstorm_flags); -} -static int cnic_bnx2x_connect (struct cnic_dev *dev,struct kwqe *wqes[],u32 num,int *work) {
@@ -2178,9 +2182,6 @@ static int cnic_bnx2x_connect(struct cnic_dev *dev, struct kwqe *wqes[],CNIC_WR16 (dev,BAR_XSTRORM_INTMEM +XSTORM_ISCSI_LOCAL_VLAN_OFFSET (cp->pfid), csk->vlan_id); -cnic_bnx2x_set_tcp_timestamp (dev, - kwqe1->tcp_flags &L4_KWQ_CONNECT_REQ1_TIME_STAMP ); - ret =cnic_submit_kwqe_16 (dev,L5CM_RAMROD_CMD_ID_TCP_CONNECT , kwqe1->cid,ISCSI_CONNECTION_TYPE , &l5_data);if (!ret)
@@ -4220,7 +4221,7 @@ static int cnic_cm_init_bnx2x_hw(struct cnic_dev *dev)u32 port =CNIC_PORT (cp);cnic_init_bnx2x_mac (dev); -cnic_bnx2x_set_tcp_timestamp (dev,1 ); +cnic_bnx2x_set_tcp_options (dev,0 ,1 );CNIC_WR16 (dev,BAR_XSTRORM_INTMEM +XSTORM_ISCSI_LOCAL_VLAN_OFFSET (pfid),0 );
drivers/net/ethernet/broadcom/cnic_defs.h +2 -2
@@ -5400,8 +5400,8 @@ struct tstorm_l5cm_tcp_flags {u16 flags;#define TSTORM_L5CM_TCP_FLAGS_VLAN_ID (0xFFF<<0)#define TSTORM_L5CM_TCP_FLAGS_VLAN_ID_SHIFT 0 -#define TSTORM_L5CM_TCP_FLAGS_RSRV0 (0x1<<12) -#define TSTORM_L5CM_TCP_FLAGS_RSRV0_SHIFT 12 +#define TSTORM_L5CM_TCP_FLAGS_DELAYED_ACK_EN (0x1<<12) +#define TSTORM_L5CM_TCP_FLAGS_DELAYED_ACK_SHIFT 12#define TSTORM_L5CM_TCP_FLAGS_TS_ENABLED (0x1<<13)#define TSTORM_L5CM_TCP_FLAGS_TS_ENABLED_SHIFT 13#define TSTORM_L5CM_TCP_FLAGS_RSRV1 (0x3<<14)
drivers/scsi/bnx2i/57xx_iscsi_hsi.h +8 -4
@@ -581,8 +581,10 @@ struct iscsi_kwqe_init1 {#define ISCSI_KWQE_INIT1_DELAYED_ACK_ENABLE_SHIFT 4#define ISCSI_KWQE_INIT1_KEEP_ALIVE_ENABLE (0x1<<5)#define ISCSI_KWQE_INIT1_KEEP_ALIVE_ENABLE_SHIFT 5 -#define ISCSI_KWQE_INIT1_RESERVED1 (0x3<<6) -#define ISCSI_KWQE_INIT1_RESERVED1_SHIFT 6 +#define ISCSI_KWQE_INIT1_TIME_STAMPS_ENABLE (0x1<<6) +#define ISCSI_KWQE_INIT1_TIME_STAMPS_ENABLE_SHIFT 6 +#define ISCSI_KWQE_INIT1_RESERVED1 (0x1<<7) +#define ISCSI_KWQE_INIT1_RESERVED1_SHIFT 7u16 cq_num_wqes;#elif defined(__LITTLE_ENDIAN)u16 cq_num_wqes;
@@ -593,8 +595,10 @@ struct iscsi_kwqe_init1 {#define ISCSI_KWQE_INIT1_DELAYED_ACK_ENABLE_SHIFT 4#define ISCSI_KWQE_INIT1_KEEP_ALIVE_ENABLE (0x1<<5)#define ISCSI_KWQE_INIT1_KEEP_ALIVE_ENABLE_SHIFT 5 -#define ISCSI_KWQE_INIT1_RESERVED1 (0x3<<6) -#define ISCSI_KWQE_INIT1_RESERVED1_SHIFT 6 +#define ISCSI_KWQE_INIT1_TIME_STAMPS_ENABLE (0x1<<6) +#define ISCSI_KWQE_INIT1_TIME_STAMPS_ENABLE_SHIFT 6 +#define ISCSI_KWQE_INIT1_RESERVED1 (0x1<<7) +#define ISCSI_KWQE_INIT1_RESERVED1_SHIFT 7u8 cq_log_wqes_per_page;#endif #if defined(__BIG_ENDIAN)
Signature · 1 line
1.7.1
PATCH 5/6 cnic: Add missing error checking for RAMROD_CMD_ID_CLOSE
From: Eddie Wai <[email protected]>
Completion status field should also be checked for non-zero error condition.
--- drivers/net/ethernet/broadcom/cnic.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/cnic.c +7 -4
@@ -4022,15 +4022,18 @@ static void cnic_cm_process_kcqe(struct cnic_dev *dev, struct kcqe *kcqe)cnic_cm_upcall (cp, csk, opcode);break ; -case L5CM_RAMROD_CMD_ID_CLOSE : -if (l4kcqe->status !=0 ) { -netdev_warn (dev->netdev,"RAMROD CLOSE compl with " -"status 0x%x\n" , l4kcqe->status); +case L5CM_RAMROD_CMD_ID_CLOSE : { +struct iscsi_kcqe *l5kcqe = (struct iscsi_kcqe *) kcqe; + +if (l4kcqe->status !=0 || l5kcqe->completion_status !=0 ) { +netdev_warn (dev->netdev,"RAMROD CLOSE compl with status 0x%x completion status 0x%x\n" , + l4kcqe->status, l5kcqe->completion_status); opcode =L4_KCQE_OPCODE_VALUE_CLOSE_COMP ;/* Fall through */ }else {break ; } + }case L4_KCQE_OPCODE_VALUE_RESET_RECEIVED :case L4_KCQE_OPCODE_VALUE_CLOSE_COMP :case L4_KCQE_OPCODE_VALUE_RESET_COMP :
Signature · 1 line
1.7.1
PATCH 6/6 cnic: Update version to 2.5.17 and copyright year.
--- drivers/net/ethernet/broadcom/cnic.c | 2 +- drivers/net/ethernet/broadcom/cnic.h | 2 +- drivers/net/ethernet/broadcom/cnic_defs.h | 2 +- drivers/net/ethernet/broadcom/cnic_if.h | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/broadcom/cnic.c +1 -1
@@ -1,6 +1,6 @@/* cnic.c: Broadcom CNIC core network driver. * -* Copyright (c) 2006-2012 Broadcom Corporation +* Copyright (c) 2006-2013 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/cnic.h +1 -1
@@ -1,6 +1,6 @@/* cnic.h: Broadcom CNIC core network driver. * -* Copyright (c) 2006-2011 Broadcom Corporation +* Copyright (c) 2006-2013 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/cnic_defs.h +1 -1
@@ -1,7 +1,7 @@/* cnic.c: Broadcom CNIC core network driver. * -* Copyright (c) 2006-2012 Broadcom Corporation +* Copyright (c) 2006-2013 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/cnic_if.h +3 -3
@@ -1,6 +1,6 @@/* cnic_if.h: Broadcom CNIC core network driver. * -* Copyright (c) 2006-2012 Broadcom Corporation +* Copyright (c) 2006-2013 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -14,8 +14,8 @@#include "bnx2x/bnx2x_mfw_req.h" -#define CNIC_MODULE_VERSION "2.5.16" -#define CNIC_MODULE_RELDATE "Dec 05, 2012" +#define CNIC_MODULE_VERSION "2.5.17" +#define CNIC_MODULE_RELDATE "July 28, 2013"#define CNIC_ULP_RDMA 0#define CNIC_ULP_ISCSI 1
Signature · 1 line
1.7.1
From: "Michael Chan" <[email protected]>
Date: Sun, 28 Jul 2013 19:03:55 -0700
Quoted 9 lines
After this earlier commit to simplify probing:
commit
4bd9b0fffb193d2e288f67f81821af32df8d4349cnic, bnx2x, bnx2: Simplify cnic probing.we can now reliably receive netdev events and we can simplify the handling of these events. We now remove the logic that tries to handle missed
NETDEV_REGISTERevents.
Quoted 5 lines
This change will allow cleanup to be simplified in the next patch. We can now rely on the play back of netdev events during
unregister_netdevice_notifier()to cleanup the structures.Signed-off-by Michael Chan <[email protected]>
Please, in the future, give me an introductory "[PATCH 0/6 ..." posting, for two reasons:
1) So that you can give me a top-level description of the changes that are happening.
2) To provide me with a single email I can reply to when I decide that the entire series is OK.
I applied this entire series, thanks.
Thanks.