Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 415199f2 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller
Browse files

cnic: Add VLAN ID as a parameter during netevent upcall



The bnx2fc driver needs to handle netdev events on VLAN devices.

Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Reviewed-by: default avatarBhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 74e49bbd
Loading
Loading
Loading
Loading
+35 −15
Original line number Original line Diff line number Diff line
@@ -5334,6 +5334,27 @@ static struct cnic_dev *is_cnic_dev(struct net_device *dev)
	return cdev;
	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
 * 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 net_device *netdev = ptr;
	struct cnic_dev *dev;
	struct cnic_dev *dev;
	int if_type;
	int new_dev = 0;
	int new_dev = 0;


	dev = cnic_from_netdev(netdev);
	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);
				cnic_ulp_start(dev);
		}
		}


		rcu_read_lock();
		cnic_rcv_netevent(cp, event, 0);
		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();


		if (event == NETDEV_GOING_DOWN) {
		if (event == NETDEV_GOING_DOWN) {
			cnic_ulp_stop(dev);
			cnic_ulp_stop(dev);
@@ -5401,6 +5408,19 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
			goto done;
			goto done;
		}
		}
		cnic_put(dev);
		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:
done:
	return NOTIFY_DONE;
	return NOTIFY_DONE;
+3 −3
Original line number Original line Diff line number Diff line
@@ -12,8 +12,8 @@
#ifndef CNIC_IF_H
#ifndef CNIC_IF_H
#define CNIC_IF_H
#define CNIC_IF_H


#define CNIC_MODULE_VERSION	"2.5.6"
#define CNIC_MODULE_VERSION	"2.5.7"
#define CNIC_MODULE_RELDATE	"July 12, 2011"
#define CNIC_MODULE_RELDATE	"July 20, 2011"


#define CNIC_ULP_RDMA		0
#define CNIC_ULP_RDMA		0
#define CNIC_ULP_ISCSI		1
#define CNIC_ULP_ISCSI		1
@@ -318,7 +318,7 @@ struct cnic_ulp_ops {
	void (*cnic_stop)(void *ulp_ctx);
	void (*cnic_stop)(void *ulp_ctx);
	void (*indicate_kcqes)(void *ulp_ctx, struct kcqe *cqes[],
	void (*indicate_kcqes)(void *ulp_ctx, struct kcqe *cqes[],
				u32 num_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_connect_complete)(struct cnic_sock *);
	void (*cm_close_complete)(struct cnic_sock *);
	void (*cm_close_complete)(struct cnic_sock *);
	void (*cm_abort_complete)(struct cnic_sock *);
	void (*cm_abort_complete)(struct cnic_sock *);
+7 −1
Original line number Original line Diff line number Diff line
@@ -767,17 +767,23 @@ static void bnx2fc_destroy_timer(unsigned long data)
 *
 *
 * @context:	adapter structure pointer
 * @context:	adapter structure pointer
 * @event:	event type
 * @event:	event type
 * @vlan_id:	vlan id - associated vlan id with this event
 *
 *
 * Handles NETDEV_UP, NETDEV_DOWN, NETDEV_GOING_DOWN,NETDEV_CHANGE and
 * Handles NETDEV_UP, NETDEV_DOWN, NETDEV_GOING_DOWN,NETDEV_CHANGE and
 * NETDEV_CHANGE_MTU events
 * 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 bnx2fc_hba *hba = (struct bnx2fc_hba *)context;
	struct fc_lport *lport = hba->ctlr.lp;
	struct fc_lport *lport = hba->ctlr.lp;
	struct fc_lport *vport;
	struct fc_lport *vport;
	u32 link_possible = 1;
	u32 link_possible = 1;


	/* Ignore vlans for now */
	if (vlan_id != 0)
		return;

	if (!test_bit(BNX2FC_CREATE_DONE, &hba->init_done)) {
	if (!test_bit(BNX2FC_CREATE_DONE, &hba->init_done)) {
		BNX2FC_MISC_DBG("driver not ready. event=%s %ld\n",
		BNX2FC_MISC_DBG("driver not ready. event=%s %ld\n",
			   hba->netdev->name, event);
			   hba->netdev->name, event);
+7 −1
Original line number Original line Diff line number Diff line
@@ -2386,14 +2386,20 @@ static void bnx2i_indicate_kcqe(void *context, struct kcqe *kcqe[],
 * bnx2i_indicate_netevent - Generic netdev event handler
 * bnx2i_indicate_netevent - Generic netdev event handler
 * @context:	adapter structure pointer
 * @context:	adapter structure pointer
 * @event:	event type
 * @event:	event type
 * @vlan_id:	vlans id - associated vlan id with this event
 *
 *
 * Handles four netdev events, NETDEV_UP, NETDEV_DOWN,
 * Handles four netdev events, NETDEV_UP, NETDEV_DOWN,
 *	NETDEV_GOING_DOWN and NETDEV_CHANGE
 *	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;
	struct bnx2i_hba *hba = context;


	/* Ignore all netevent coming from vlans */
	if (vlan_id != 0)
		return;

	switch (event) {
	switch (event) {
	case NETDEV_UP:
	case NETDEV_UP:
		if (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state))
		if (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state))