diff options
author | Yi Zou <yi.zou@intel.com> | 2009-10-21 19:27:52 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:00:32 -0500 |
commit | 7221d7e59d1c675828b6de50b757cd8282011a5d (patch) | |
tree | 2de8290538954a973c33db0c8887aa1c44137993 /drivers/scsi/fcoe | |
parent | 8eca355fa8af660557fbdd5506bde1392eee9bfe (diff) |
[SCSI] fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs)
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>
Diffstat (limited to 'drivers/scsi/fcoe')
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 10 | ||||
-rw-r--r-- | drivers/scsi/fcoe/fcoe.h | 6 |
2 files changed, 14 insertions, 2 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 8702c8d728dd..c66b9fa7d674 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -439,8 +439,12 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev) | |||
439 | * user-configured limit. If the MFS is too low, fcoe_link_ok() | 439 | * user-configured limit. If the MFS is too low, fcoe_link_ok() |
440 | * will return 0, so do this first. | 440 | * will return 0, so do this first. |
441 | */ | 441 | */ |
442 | mfs = netdev->mtu - (sizeof(struct fcoe_hdr) + | 442 | mfs = netdev->mtu; |
443 | sizeof(struct fcoe_crc_eof)); | 443 | if (netdev->features & NETIF_F_FCOE_MTU) { |
444 | mfs = FCOE_MTU; | ||
445 | FCOE_NETDEV_DBG(netdev, "Supports FCOE_MTU of %d bytes\n", mfs); | ||
446 | } | ||
447 | mfs -= (sizeof(struct fcoe_hdr) + sizeof(struct fcoe_crc_eof)); | ||
444 | if (fc_set_mfs(lp, mfs)) | 448 | if (fc_set_mfs(lp, mfs)) |
445 | return -EINVAL; | 449 | return -EINVAL; |
446 | 450 | ||
@@ -1570,6 +1574,8 @@ static int fcoe_device_notification(struct notifier_block *notifier, | |||
1570 | case NETDEV_CHANGE: | 1574 | case NETDEV_CHANGE: |
1571 | break; | 1575 | break; |
1572 | case NETDEV_CHANGEMTU: | 1576 | case NETDEV_CHANGEMTU: |
1577 | if (netdev->features & NETIF_F_FCOE_MTU) | ||
1578 | break; | ||
1573 | mfs = netdev->mtu - (sizeof(struct fcoe_hdr) + | 1579 | mfs = netdev->mtu - (sizeof(struct fcoe_hdr) + |
1574 | sizeof(struct fcoe_crc_eof)); | 1580 | sizeof(struct fcoe_crc_eof)); |
1575 | if (mfs >= FC_MIN_MAX_FRAME) | 1581 | if (mfs >= FC_MIN_MAX_FRAME) |
diff --git a/drivers/scsi/fcoe/fcoe.h b/drivers/scsi/fcoe/fcoe.h index ce7f60fb1bc0..c578082aef8b 100644 --- a/drivers/scsi/fcoe/fcoe.h +++ b/drivers/scsi/fcoe/fcoe.h | |||
@@ -40,6 +40,12 @@ | |||
40 | #define FCOE_MIN_XID 0x0000 /* the min xid supported by fcoe_sw */ | 40 | #define FCOE_MIN_XID 0x0000 /* the min xid supported by fcoe_sw */ |
41 | #define FCOE_MAX_XID 0x0FFF /* the max xid supported by fcoe_sw */ | 41 | #define FCOE_MAX_XID 0x0FFF /* the max xid supported by fcoe_sw */ |
42 | 42 | ||
43 | /* | ||
44 | * Max MTU for FCoE: 14 (FCoE header) + 24 (FC header) + 2112 (max FC payload) | ||
45 | * + 4 (FC CRC) + 4 (FCoE trailer) = 2158 bytes | ||
46 | */ | ||
47 | #define FCOE_MTU 2158 | ||
48 | |||
43 | unsigned int fcoe_debug_logging; | 49 | unsigned int fcoe_debug_logging; |
44 | module_param_named(debug_logging, fcoe_debug_logging, int, S_IRUGO|S_IWUSR); | 50 | module_param_named(debug_logging, fcoe_debug_logging, int, S_IRUGO|S_IWUSR); |
45 | MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels"); | 51 | MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels"); |