]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
[SCSI] fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs)
authorYi Zou <yi.zou@intel.com>
Wed, 21 Oct 2009 23:27:52 +0000 (16:27 -0700)
committerJames Bottomley <James.Bottomley@suse.de>
Fri, 4 Dec 2009 18:00:32 +0000 (12:00 -0600)
Add a define of FCOE_MTU as 2158 bytes and use FCOE_MTU when the LLD is found
to support NETIF_F_FCOE_MTU. The lport->mfs is then calculated out of the
2158 FCOE_MTU. Otherwise, we stick with the netdev->mtu, i.e., LAN MTU. Also,
change the notification on NETDEV_CHANGEMTU event to bypass changing mfs when
LAN MTU is changed if NETIF_F_FCOE_MTU is supported.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/fcoe/fcoe.c
drivers/scsi/fcoe/fcoe.h

index 8702c8d728dd21d6c85caeafcaf56db107c39ed8..c66b9fa7d674c2b78be17f6cb4ec13ac3bf48bff 100644 (file)
@@ -439,8 +439,12 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev)
         * user-configured limit.  If the MFS is too low, fcoe_link_ok()
         * will return 0, so do this first.
         */
-       mfs = netdev->mtu - (sizeof(struct fcoe_hdr) +
-                            sizeof(struct fcoe_crc_eof));
+       mfs = netdev->mtu;
+       if (netdev->features & NETIF_F_FCOE_MTU) {
+               mfs = FCOE_MTU;
+               FCOE_NETDEV_DBG(netdev, "Supports FCOE_MTU of %d bytes\n", mfs);
+       }
+       mfs -= (sizeof(struct fcoe_hdr) + sizeof(struct fcoe_crc_eof));
        if (fc_set_mfs(lp, mfs))
                return -EINVAL;
 
@@ -1570,6 +1574,8 @@ static int fcoe_device_notification(struct notifier_block *notifier,
        case NETDEV_CHANGE:
                break;
        case NETDEV_CHANGEMTU:
+               if (netdev->features & NETIF_F_FCOE_MTU)
+                       break;
                mfs = netdev->mtu - (sizeof(struct fcoe_hdr) +
                                     sizeof(struct fcoe_crc_eof));
                if (mfs >= FC_MIN_MAX_FRAME)
index ce7f60fb1bc0b06f5f0b2fc358d2e133c8d03486..c578082aef8bbbc421649adcfe00dfada0d90192 100644 (file)
 #define FCOE_MIN_XID           0x0000  /* the min xid supported by fcoe_sw */
 #define FCOE_MAX_XID           0x0FFF  /* the max xid supported by fcoe_sw */
 
+/*
+ * Max MTU for FCoE: 14 (FCoE header) + 24 (FC header) + 2112 (max FC payload)
+ * + 4 (FC CRC) + 4 (FCoE trailer) =  2158 bytes
+ */
+#define FCOE_MTU       2158
+
 unsigned int fcoe_debug_logging;
 module_param_named(debug_logging, fcoe_debug_logging, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels");