Skip to content

Commit 415199f

Browse files
Michael Chandavem330
authored andcommitted
cnic: Add VLAN ID as a parameter during netevent upcall
The bnx2fc driver needs to handle netdev events on VLAN devices. Signed-off-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 74e49bb commit 415199f

4 files changed

Lines changed: 52 additions & 20 deletions

File tree

‎drivers/net/cnic.c‎

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5334,6 +5334,27 @@ static struct cnic_dev *is_cnic_dev(struct net_device *dev)
53345334
return cdev;
53355335
}
53365336

5337+
static void cnic_rcv_netevent(struct cnic_local *cp, unsigned long event,
5338+
u16 vlan_id)
5339+
{
5340+
int if_type;
5341+
5342+
rcu_read_lock();
5343+
for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) {
5344+
struct cnic_ulp_ops *ulp_ops;
5345+
void *ctx;
5346+
5347+
ulp_ops = rcu_dereference(cp->ulp_ops[if_type]);
5348+
if (!ulp_ops || !ulp_ops->indicate_netevent)
5349+
continue;
5350+
5351+
ctx = cp->ulp_handle[if_type];
5352+
5353+
ulp_ops->indicate_netevent(ctx, event, vlan_id);
5354+
}
5355+
rcu_read_unlock();
5356+
}
5357+
53375358
/**
53385359
* netdev event handler
53395360
*/
@@ -5342,7 +5363,6 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
53425363
{
53435364
struct net_device *netdev = ptr;
53445365
struct cnic_dev *dev;
5345-
int if_type;
53465366
int new_dev = 0;
53475367

53485368
dev = cnic_from_netdev(netdev);
@@ -5372,20 +5392,7 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
53725392
cnic_ulp_start(dev);
53735393
}
53745394

5375-
rcu_read_lock();
5376-
for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) {
5377-
struct cnic_ulp_ops *ulp_ops;
5378-
void *ctx;
5379-
5380-
ulp_ops = rcu_dereference(cp->ulp_ops[if_type]);
5381-
if (!ulp_ops || !ulp_ops->indicate_netevent)
5382-
continue;
5383-
5384-
ctx = cp->ulp_handle[if_type];
5385-
5386-
ulp_ops->indicate_netevent(ctx, event);
5387-
}
5388-
rcu_read_unlock();
5395+
cnic_rcv_netevent(cp, event, 0);
53895396

53905397
if (event == NETDEV_GOING_DOWN) {
53915398
cnic_ulp_stop(dev);
@@ -5401,6 +5408,19 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
54015408
goto done;
54025409
}
54035410
cnic_put(dev);
5411+
} else {
5412+
struct net_device *realdev;
5413+
u16 vid;
5414+
5415+
vid = cnic_get_vlan(netdev, &realdev);
5416+
if (realdev) {
5417+
dev = cnic_from_netdev(realdev);
5418+
if (dev) {
5419+
vid |= VLAN_TAG_PRESENT;
5420+
cnic_rcv_netevent(dev->cnic_priv, event, vid);
5421+
cnic_put(dev);
5422+
}
5423+
}
54045424
}
54055425
done:
54065426
return NOTIFY_DONE;

‎drivers/net/cnic_if.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#ifndef CNIC_IF_H
1313
#define CNIC_IF_H
1414

15-
#define CNIC_MODULE_VERSION "2.5.6"
16-
#define CNIC_MODULE_RELDATE "July 12, 2011"
15+
#define CNIC_MODULE_VERSION "2.5.7"
16+
#define CNIC_MODULE_RELDATE "July 20, 2011"
1717

1818
#define CNIC_ULP_RDMA 0
1919
#define CNIC_ULP_ISCSI 1
@@ -318,7 +318,7 @@ struct cnic_ulp_ops {
318318
void (*cnic_stop)(void *ulp_ctx);
319319
void (*indicate_kcqes)(void *ulp_ctx, struct kcqe *cqes[],
320320
u32 num_cqes);
321-
void (*indicate_netevent)(void *ulp_ctx, unsigned long event);
321+
void (*indicate_netevent)(void *ulp_ctx, unsigned long event, u16 vid);
322322
void (*cm_connect_complete)(struct cnic_sock *);
323323
void (*cm_close_complete)(struct cnic_sock *);
324324
void (*cm_abort_complete)(struct cnic_sock *);

‎drivers/scsi/bnx2fc/bnx2fc_fcoe.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,17 +767,23 @@ static void bnx2fc_destroy_timer(unsigned long data)
767767
*
768768
* @context: adapter structure pointer
769769
* @event: event type
770+
* @vlan_id: vlan id - associated vlan id with this event
770771
*
771772
* Handles NETDEV_UP, NETDEV_DOWN, NETDEV_GOING_DOWN,NETDEV_CHANGE and
772773
* NETDEV_CHANGE_MTU events
773774
*/
774-
static void bnx2fc_indicate_netevent(void *context, unsigned long event)
775+
static void bnx2fc_indicate_netevent(void *context, unsigned long event,
776+
u16 vlan_id)
775777
{
776778
struct bnx2fc_hba *hba = (struct bnx2fc_hba *)context;
777779
struct fc_lport *lport = hba->ctlr.lp;
778780
struct fc_lport *vport;
779781
u32 link_possible = 1;
780782

783+
/* Ignore vlans for now */
784+
if (vlan_id != 0)
785+
return;
786+
781787
if (!test_bit(BNX2FC_CREATE_DONE, &hba->init_done)) {
782788
BNX2FC_MISC_DBG("driver not ready. event=%s %ld\n",
783789
hba->netdev->name, event);

‎drivers/scsi/bnx2i/bnx2i_hwi.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2386,14 +2386,20 @@ static void bnx2i_indicate_kcqe(void *context, struct kcqe *kcqe[],
23862386
* bnx2i_indicate_netevent - Generic netdev event handler
23872387
* @context: adapter structure pointer
23882388
* @event: event type
2389+
* @vlan_id: vlans id - associated vlan id with this event
23892390
*
23902391
* Handles four netdev events, NETDEV_UP, NETDEV_DOWN,
23912392
* NETDEV_GOING_DOWN and NETDEV_CHANGE
23922393
*/
2393-
static void bnx2i_indicate_netevent(void *context, unsigned long event)
2394+
static void bnx2i_indicate_netevent(void *context, unsigned long event,
2395+
u16 vlan_id)
23942396
{
23952397
struct bnx2i_hba *hba = context;
23962398

2399+
/* Ignore all netevent coming from vlans */
2400+
if (vlan_id != 0)
2401+
return;
2402+
23972403
switch (event) {
23982404
case NETDEV_UP:
23992405
if (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state))

0 commit comments

Comments
 (0)