Subject: [PATCH 3/7] fcoe: check offload features from LLD through netdev

From: Yi Zou <[email-masked]>
Date: Thu, 19 Feb 2009 12:49:57 -0700

This checkes if net_devices supports net_fcoe_ops, if it does, then sets up
the corresponding flags in the associated fc_lport.

Note that large sequence offload is already supported in the current
libfc/fcoe, only thing needed is to tell the corresponding fc_lport that LLD
is capabale of doing so by using fcoe_ops->features.

Signed-off-by: Yi Zou <[email-masked]>
---

 drivers/scsi/fcoe/fcoe_sw.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe_sw.c b/drivers/scsi/fcoe/fcoe_sw.c
index fe1bcaa..7632d7e 100644
--- a/drivers/scsi/fcoe/fcoe_sw.c
+++ b/drivers/scsi/fcoe/fcoe_sw.c
@@ -188,6 +188,33 @@ static int fcoe_sw_netdev_config(struct fc_lport *lp, struct net_device *netdev)
 	if (fc->real_dev->features & NETIF_F_SG)
 		lp->sg_supp = 1;
 
+	lp->crc_offload = 0;
+	lp->seq_offload = 0;
+	lp->lro_enabled = 0;
+	if (netdev->fcoe_ops) {
+		struct net_fcoe_ops *fops = netdev->fcoe_ops;
+
+		if (fops->features & NET_FCOE_CRC) {
+			lp->crc_offload = 1;
+			FCOE_DBG("%s supports FCoE FCCRC offload\n",
+				 netdev->name);
+		}
+
+		if (fops->features & NET_FCOE_LSO) {
+			lp->seq_offload = 1;
+			FCOE_DBG("%s supports FCoE large send offload\n",
+				 netdev->name);
+		}
+
+		if ((fops->features & NET_FCOE_LRO) &&
+		    (fops->lro_xid)) {
+			lp->lro_enabled = 1;
+			lp->lro_xid = fops->lro_xid;
+			FCOE_DBG("%s supports FCoE large receive offload "
+				 "with max read exchange id for ddp %d\n",
+				 netdev->name, lp->lro_xid);
+		}
+	}
 
 	skb_queue_head_init(&fc->fcoe_pending_queue);