linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: James.Bottomley@suse.de, linux-scsi@vger.kernel.org
Cc: Yi Zou <yi.zou@intel.com>
Subject: [PATCH 25/28] fcoe: fix offload feature flag change from netdev
Date: Tue, 20 Jul 2010 15:21:17 -0700	[thread overview]
Message-ID: <20100720222117.17116.56926.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100720221904.17116.78553.stgit@localhost.localdomain>

From: Yi Zou <yi.zou@intel.com>

Currently, when FCoE netdev feature flags are toggled by the LLD, lport's
corresponding flags are not updated. This causes the fc_fcp to still try to
offload the I/O. This patch adds support of NETDEV_FEAT_CHANGE event in fcoe
netdev device notification callback so we can update the lport offload flags
appropriately.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
 drivers/scsi/fcoe/fcoe.c |   68 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 49 insertions(+), 19 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index ab6ea60..cf9d718 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -589,6 +589,50 @@ static int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
 }
 
 /**
+ * fcoe_netdev_features_change - Updates the lport's offload flags based
+ * on the LLD netdev's FCoE feature flags
+ */
+static void fcoe_netdev_features_change(struct fc_lport *lport,
+					struct net_device *netdev)
+{
+	mutex_lock(&lport->lp_mutex);
+
+	if (netdev->features & NETIF_F_SG)
+		lport->sg_supp = 1;
+	else
+		lport->sg_supp = 0;
+
+	if (netdev->features & NETIF_F_FCOE_CRC) {
+		lport->crc_offload = 1;
+		FCOE_NETDEV_DBG(netdev, "Supports FCCRC offload\n");
+	} else {
+		lport->crc_offload = 0;
+	}
+
+	if (netdev->features & NETIF_F_FSO) {
+		lport->seq_offload = 1;
+		lport->lso_max = netdev->gso_max_size;
+		FCOE_NETDEV_DBG(netdev, "Supports LSO for max len 0x%x\n",
+				lport->lso_max);
+	} else {
+		lport->seq_offload = 0;
+		lport->lso_max = 0;
+	}
+
+	if (netdev->fcoe_ddp_xid) {
+		lport->lro_enabled = 1;
+		lport->lro_xid = netdev->fcoe_ddp_xid;
+		FCOE_NETDEV_DBG(netdev, "Supports LRO for max xid 0x%x\n",
+				lport->lro_xid);
+	} else {
+		lport->lro_enabled = 0;
+		lport->lro_xid = 0;
+	}
+
+	mutex_unlock(&lport->lp_mutex);
+}
+
+/**
  * fcoe_netdev_config() - Set up net devive for SW FCoE
  * @lport:  The local port that is associated with the net device
  * @netdev: The associated net device
@@ -624,25 +668,8 @@ static int fcoe_netdev_config(struct fc_lport *lport, struct net_device *netdev)
 		return -EINVAL;
 
 	/* offload features support */
-	if (netdev->features & NETIF_F_SG)
-		lport->sg_supp = 1;
+	fcoe_netdev_features_change(lport, netdev);
 
-	if (netdev->features & NETIF_F_FCOE_CRC) {
-		lport->crc_offload = 1;
-		FCOE_NETDEV_DBG(netdev, "Supports FCCRC offload\n");
-	}
-	if (netdev->features & NETIF_F_FSO) {
-		lport->seq_offload = 1;
-		lport->lso_max = netdev->gso_max_size;
-		FCOE_NETDEV_DBG(netdev, "Supports LSO for max len 0x%x\n",
-				lport->lso_max);
-	}
-	if (netdev->fcoe_ddp_xid) {
-		lport->lro_enabled = 1;
-		lport->lro_xid = netdev->fcoe_ddp_xid;
-		FCOE_NETDEV_DBG(netdev, "Supports LRO for max xid 0x%x\n",
-				lport->lro_xid);
-	}
 	skb_queue_head_init(&port->fcoe_pending_queue);
 	port->fcoe_pending_queue_active = 0;
 	setup_timer(&port->timer, fcoe_queue_timer, (unsigned long)lport);
@@ -1861,6 +1888,9 @@ static int fcoe_device_notification(struct notifier_block *notifier,
 		schedule_work(&port->destroy_work);
 		goto out;
 		break;
+	case NETDEV_FEAT_CHANGE:
+		fcoe_netdev_features_change(lport, netdev);
+		break;
 	default:
 		FCOE_NETDEV_DBG(netdev, "Unknown event %ld "
 				"from netdev netlink\n", event);
@@ -2056,8 +2086,8 @@ static int fcoe_destroy(const char *buffer, struct kernel_param *kp)
 		rc = -ENODEV;
 		goto out_putdev;
 	}
-	list_del(&fcoe->list);
 	fcoe_interface_cleanup(fcoe);
+	list_del(&fcoe->list);
 	/* RTNL mutex is dropped by fcoe_if_destroy */
 	fcoe_if_destroy(fcoe->ctlr.lp);
 


  parent reply	other threads:[~2010-07-20 22:21 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-20 22:19 [PATCH 00/28] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
2010-07-20 22:19 ` [PATCH 01/28] libfc: fix slowpath error from WARN_ON in fc_fcp_send_data Robert Love
2010-07-20 22:19 ` [PATCH 02/28] fcoe: make it possible to verify fcoe with sparse Robert Love
2010-07-20 22:19 ` [PATCH 03/28] libfc: IO errors on link down due to cable unplug Robert Love
2010-07-21  3:29   ` Mike Christie
2010-07-27 21:32     ` Vasu Dev
2010-07-27 22:08       ` Mike Christie
2010-07-28  7:32       ` Mike Christie
2010-07-30 20:34         ` Vasu Dev
2010-07-20 22:19 ` [PATCH 04/28] fcoe: cleans up fcoe_disable and fcoe_enable Robert Love
2010-07-20 22:19 ` [PATCH 05/28] fcoe: adds src and dest mac address checking for fcoe frames Robert Love
2010-07-20 22:19 ` [PATCH 06/28] libfc: convert rport lookup to be RCU safe Robert Love
2010-07-20 22:19 ` [PATCH 07/28] libfc: provide space for LLD after remote port structure Robert Love
2010-07-20 22:19 ` [PATCH 08/28] libfcoe: convert FIP to lock with mutex instead of spin lock Robert Love
2010-07-20 22:19 ` [PATCH 09/28] libfc: add discovery-private pointer for LLD Robert Love
2010-07-20 22:19 ` [PATCH 10/28] libfcoe: fcoe: fnic: change fcoe_ctlr_init interface to specify mode Robert Love
2010-07-20 22:20 ` [PATCH 11/28] libfc: Add local port point-to-multipoint flag Robert Love
2010-07-20 22:20 ` [PATCH 12/28] libfc: add FLOGI state to rport for VN2VN Robert Love
2010-07-20 22:20 ` [PATCH 13/28] libfc: track FIP exchanges Robert Love
2010-07-20 22:20 ` [PATCH 14/28] libfcoe: add protocol description of FIP VN2VN mode Robert Love
2010-07-20 22:20 ` [PATCH 15/28] libfcoe: add state change debugging Robert Love
2010-07-20 22:20 ` [PATCH 16/28] libfcoe: fcoe: fnic: add FIP VN2VN point-to-multipoint support Robert Love
2010-07-20 22:20 ` [PATCH 17/28] libfcoe: Fix FIP ELS encapsulation details for FLOGI responses Robert Love
2010-07-20 22:20 ` [PATCH 18/28] fcoe libfcoe: use correct FC-MAP for VN2VN mode Robert Love
2010-07-20 22:20 ` [PATCH 19/28] fcoe: config via separate create_vn2vn module parameter Robert Love
2010-07-20 22:20 ` [PATCH 20/28] libfc: eliminate rport LOGO state Robert Love
2010-07-20 22:20 ` [PATCH 21/28] libfc: add fc_frame_sid() and fc_frame_did() functions Robert Love
2010-07-20 22:21 ` [PATCH 22/28] libfc: add fc_fill_reply_hdr() and fc_fill_hdr() Robert Love
2010-07-20 22:21 ` [PATCH 23/28] libfc: add interface to allocate a sequence for incoming requests Robert Love
2010-07-20 22:21 ` [PATCH 24/28] libfc: don't require a local exchange " Robert Love
2010-07-20 22:21 ` Robert Love [this message]
2010-07-20 22:21 ` [PATCH 26/28] Revert "[SCSI] fcoe: Fix using VLAN ID in creating lport's WWWN/WWPN" Robert Love
2010-07-20 22:21 ` [PATCH 27/28] libfc: Add retry logic to lport state machine when receiving LS_RJT Robert Love
2010-07-20 22:21 ` [PATCH 28/28] fcoe: remove check for zero fabric name Robert Love

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100720222117.17116.56926.stgit@localhost.localdomain \
    --to=robert.w.love@intel.com \
    --cc=James.Bottomley@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=yi.zou@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).