Skip to contentSkip to conversation

vlan: adds fcoe offload related net_device_ops and updates fcoe_ddp_xid field

PATCH In review Jeff Kirsher 6 participants 10 messages Jul 22, 2009 – Jul 27, 2009 3 messages not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 vlan: adds fcoe offload related net_device_ops and updates fcoe_ddp_xid field

From: Vasu Dev <[email protected]>

Adds fcoe offload related net_device_ops functions vlan_dev_fcoe_ddp_setup and vlan_dev_fcoe_ddp_done, their implementation simply calls real eth device net_device_ops for FCoE DDP setup and done operations.

Updates VLAN netdev field value for fcoe_ddp_xid from real eth device netdev.

Above changes are required for fcoe DDP offload working on a VLAN interface.

---

 net/8021q/vlan_dev.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)
net/8021q/vlan_dev.c +39 -0
index 96bad8f..6e695ac 100644
@@ -561,6 +561,33 @@ static int vlan_dev_neigh_setup(struct net_device *dev, struct neigh_parms *pa)
 	return err;
 }
 
+#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
+static int vlan_dev_fcoe_ddp_setup(struct net_device *dev, u16 xid,
+				   struct scatterlist *sgl, unsigned int sgc)
+{
+	struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
+	const struct net_device_ops *ops = real_dev->netdev_ops;
+	int rc = 0;
+
+	if (ops->ndo_fcoe_ddp_setup)
+		rc = ops->ndo_fcoe_ddp_setup(real_dev, xid, sgl, sgc);
+
+	return rc;
+}
+
+static int vlan_dev_fcoe_ddp_done(struct net_device *dev, u16 xid)
+{
+	struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
+	const struct net_device_ops *ops = real_dev->netdev_ops;
+	int len = 0;
+
+	if (ops->ndo_fcoe_ddp_done)
+		len = ops->ndo_fcoe_ddp_done(real_dev, xid);
+
+	return len;
+}
+#endif
+
 static void vlan_dev_change_rx_flags(struct net_device *dev, int change)
 {
 	struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
@@ -635,6 +662,10 @@ static int vlan_dev_init(struct net_device *dev)
 	if (is_zero_ether_addr(dev->broadcast))
 		memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len);
 
+#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
+	dev->fcoe_ddp_xid = real_dev->fcoe_ddp_xid;
+#endif
+
 	if (real_dev->features & NETIF_F_HW_VLAN_TX) {
 		dev->header_ops      = real_dev->header_ops;
 		dev->hard_header_len = real_dev->hard_header_len;
@@ -715,6 +746,10 @@ static const struct net_device_ops vlan_netdev_ops = {
 	.ndo_change_rx_flags	= vlan_dev_change_rx_flags,
 	.ndo_do_ioctl		= vlan_dev_ioctl,
 	.ndo_neigh_setup	= vlan_dev_neigh_setup,
+#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
+	.ndo_fcoe_ddp_setup	= vlan_dev_fcoe_ddp_setup,
+	.ndo_fcoe_ddp_done	= vlan_dev_fcoe_ddp_done,
+#endif
 };
 
 static const struct net_device_ops vlan_netdev_accel_ops = {
@@ -731,6 +766,10 @@ static const struct net_device_ops vlan_netdev_accel_ops = {
 	.ndo_change_rx_flags	= vlan_dev_change_rx_flags,
 	.ndo_do_ioctl		= vlan_dev_ioctl,
 	.ndo_neigh_setup	= vlan_dev_neigh_setup,
+#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
+	.ndo_fcoe_ddp_setup	= vlan_dev_fcoe_ddp_setup,
+	.ndo_fcoe_ddp_done	= vlan_dev_fcoe_ddp_done,
+#endif
 };
 
 void vlan_setup(struct net_device *dev)

A message that is not in the archive (sent off-list or not yet received): 20090722232759.26937.78765.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]

#2 lore raw

PATCH 2/5 ixgbe: updates vlan feature flags to enable FCoE offloads on vlan interface

From: Vasu Dev <[email protected]>

Updates netdev->vlan_features for NETIF_F_FCOE_CRC and NETIF_F_FSO, so that FCoE CRC and GSO offloads will get used for FCoE over ixgbe based vlan interface.

---

 drivers/net/ixgbe/ixgbe_main.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +2 -0
index 79f60e8..d89c695 100644
@@ -5588,6 +5588,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
 			if (!(device_caps & IXGBE_DEVICE_CAPS_FCOE_OFFLOADS)) {
 				netdev->features |= NETIF_F_FCOE_CRC;
 				netdev->features |= NETIF_F_FSO;
+				netdev->vlan_features |= NETIF_F_FCOE_CRC;
+				netdev->vlan_features |= NETIF_F_FSO;
 				netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1;
 			} else {
 				adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
#3 lore raw

PATCH 3/5 net: Add NETIF_F_FCOE_MTU to indicate support for a different MTU for FCoE

In reply to a message not in the archive

From: Yi Zou <[email protected]>

Add NETIF_F_FCOE_MTU to indicate that the NIC can support a secondary MTU for converged traffic of LAN and Fiber Channel over Ethernet (FCoE). The MTU for FCoE is 2158 = 14 (FCoE header) + 24 (FC header) + 2112 (FC max payload) + 4 (FC CRC) + 4 (FCoE trailer).

---

 include/linux/netdevice.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/netdevice.h +1 -0
index 9f25ab2..9192cdf 100644
@@ -701,6 +701,7 @@ struct net_device
 /* the GSO_MASK reserves bits 16 through 23 */
 #define NETIF_F_FCOE_CRC	(1 << 24) /* FCoE CRC32 */
 #define NETIF_F_SCTP_CSUM	(1 << 25) /* SCTP checksum offload */
+#define NETIF_F_FCOE_MTU	(1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
 
 	/* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT	16
#4 lore raw

PATCH 4/5 ixgbe: Add support for NETIF_F_FCOE_MTU to 82599 devices

In reply to a message not in the archive

From: Yi Zou <[email protected]>

Enable netdev feature flag bit NETIF_F_FCOE_MTU for 82599 devices and enable jumbo frame correspondingly when NETIF_F_FCOE_MTU is set.

---

 drivers/net/ixgbe/ixgbe_main.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +5 -3
index d89c695..2852a17 100644
@@ -2043,7 +2043,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
 	else
 		hlreg0 |= IXGBE_HLREG0_JUMBOEN;
 #ifdef IXGBE_FCOE
-	if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
+	if (netdev->features & NETIF_F_FCOE_MTU)
 		hlreg0 |= IXGBE_HLREG0_JUMBOEN;
 #endif
 	IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0);
@@ -2070,7 +2070,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
 		adapter->rx_ring[i].rx_buf_len = rx_buf_len;
 
 #ifdef IXGBE_FCOE
-		if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) {
+		if (netdev->features & NETIF_F_FCOE_MTU) {
 			struct ixgbe_ring_feature *f;
 			f = &adapter->ring_feature[RING_F_FCOE];
 			if ((rx_buf_len < IXGBE_FCOE_JUMBO_FRAME_SIZE) &&
@@ -2619,7 +2619,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
 
 #ifdef IXGBE_FCOE
 	/* adjust max frame to be able to do baby jumbo for FCoE */
-	if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) &&
+	if ((netdev->features & NETIF_F_FCOE_MTU) &&
 	    (max_frame < IXGBE_FCOE_JUMBO_FRAME_SIZE))
 		max_frame = IXGBE_FCOE_JUMBO_FRAME_SIZE;
 
@@ -5588,8 +5588,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
 			if (!(device_caps & IXGBE_DEVICE_CAPS_FCOE_OFFLOADS)) {
 				netdev->features |= NETIF_F_FCOE_CRC;
 				netdev->features |= NETIF_F_FSO;
+				netdev->features |= NETIF_F_FCOE_MTU;
 				netdev->vlan_features |= NETIF_F_FCOE_CRC;
 				netdev->vlan_features |= NETIF_F_FSO;
+				netdev->vlan_features |= NETIF_F_FCOE_MTU;
 				netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1;
 			} else {
 				adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
#5 lore raw

PATCH 5/5 fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs)

In reply to a message not in the archive

From: Yi Zou <[email protected]>

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.

---

 drivers/scsi/fcoe/fcoe.c |   11 +++++++++--
 drivers/scsi/fcoe/fcoe.h |    4 ++++
 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/scsi/fcoe/fcoe.c +9 -2
index 0a5609b..e0a885c 100644
@@ -291,8 +291,13 @@ 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 = fc->real_dev->mtu - (sizeof(struct fcoe_hdr) +
-				   sizeof(struct fcoe_crc_eof));
+	mfs = fc->real_dev->mtu;
+	if (fc->phys_dev->features & NETIF_F_FCOE_MTU) {
+		mfs = FCOE_MTU;
+		printk(KERN_DEBUG "fcoe:%s supports FCOE_MTU of %d bytes\n",
+		       netdev->name, mfs);
+	}
+	mfs -= (sizeof(struct fcoe_hdr) + sizeof(struct fcoe_crc_eof));
 	if (fc_set_mfs(lp, mfs))
 		return -EINVAL;
 
@@ -1420,6 +1425,8 @@ static int fcoe_device_notification(struct notifier_block *notifier,
 	case NETDEV_CHANGE:
 		break;
 	case NETDEV_CHANGEMTU:
+		if (fc->phys_dev->features & NETIF_F_FCOE_MTU)
+			break;
 		mfs = fc->real_dev->mtu -
 			(sizeof(struct fcoe_hdr) +
 			 sizeof(struct fcoe_crc_eof));
drivers/scsi/fcoe/fcoe.h +4 -0
index 0d724fa..be9735d 100644
@@ -64,6 +64,10 @@ do {                                                            	\
 			   printk(KERN_INFO "fcoe: %s" fmt,	\
 				  netdev->name, ##args);)
 
+/* 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
+
 /*
  * this percpu struct for fcoe
  */
#6 lore raw

Re: [Open-FCoE] [net-next-2.6 PATCH 5/5] fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs)

Quoted 11 lines · Jeff Kirsher

From: Yi Zou <[email protected]>

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.

---

Hi Dave,

Please don't apply this patch to net-next. The other 4 patches in this series should be fine without it. If this patch is applied to net-next it means that most/all of the other fcoe features (that will go through linux-scsi) become dependent on this patch.

I was hoping to push the other fcoe features as-is and then push this patch through linux-scsi after the other 4 patches in this series had been merged by you.

Thanks, //Rob

maintainer
#7 lore raw

Re: [Open-FCoE] [net-next-2.6 PATCH 5/5] fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs)

From: Robert Love <[email protected]>
Date: Thu, 23 Jul 2009 11:27:28 -0700

Quoted 8 lines

Please don't apply this patch to net-next. The other 4 patches in this series should be fine without it. If this patch is applied to net-next it means that most/all of the other fcoe features (that will go through linux-scsi) become dependent on this patch.

I was hoping to push the other fcoe features as-is and then push this patch through linux-scsi after the other 4 patches in this series had been merged by you.

Sure, I was just reading over this stuff.

But on the other hand, linux-scsi will be dependant upon net-next-2.6 because this patch here uses flags that will only be added there.

Therefore there has to be a dependency in one direction or another, the question is which one works better for you FCOE guys.

The best thing to do in these situations is usually to create the dependency and merge into the tree where most of the subsystem specific bits (and thus developer ACKs) are needed. And then just occaisionally go and ask the other subsystem guys for ACKs when necessary.

A message that is not in the archive (sent off-list or not yet received): 20090723.114002.51085260.davem-fT/PcQaiUtIeIZ0/[email protected]

#9 lore raw

Re: [net-next-2.6 PATCH 5/5] fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs)

Quoted 8 lines · David Miller

From: Robert Love <[email protected]>
Date: Thu, 23 Jul 2009 11:27:28 -0700

Quoted 5 lines

Please don't apply this patch to net-next. The other 4 patches in this series should be fine without it. If this patch is applied to net-next it means that most/all of the other fcoe features (that will go through linux-scsi) become dependent on this patch.

Quoted 9 lines
Quoted 3 lines

I was hoping to push the other fcoe features as-is and then push this patch through linux-scsi after the other 4 patches in this series had been merged by you.

Sure, I was just reading over this stuff.

But on the other hand, linux-scsi will be dependant upon net-next-2.6 because this patch here uses flags that will only be added there.

Yes, absolutely, but it's only this small patch that creates the dependency. I figured that all of the other fcoe patches could go into James' scsi-misc tree and get merged first. Then this one could go into his scsi-post-merge tree and depend on net-next.

It's really up to you and James, I just thought that would be easier.

Quoted 13 lines

Therefore there has to be a dependency in one direction or another, the question is which one works better for you FCOE guys.

The best thing to do in these situations is usually to create the dependency and merge into the tree where most of the subsystem specific bits (and thus developer ACKs) are needed. And then just occaisionally go and ask the other subsystem guys for ACKs when necessary.

_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

#10 lore raw

Re: [net-next-2.6 PATCH 5/5] fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs)

From: Robert Love <[email protected]>
Date: Thu, 23 Jul 2009 11:48:03 -0700

Quoted 6 lines

Yes, absolutely, but it's only this small patch that creates the dependency. I figured that all of the other fcoe patches could go into James' scsi-misc tree and get merged first. Then this one could go into his scsi-post-merge tree and depend on net-next.

It's really up to you and James, I just thought that would be easier.

So I tried to apply just the networking bits but none of the ixgbe parts apply properly to net-next-2.6, so this patch series will need to be respun and resubmitted in it's entirety so I can apply it properly.

It seems that the ixgbe driver now maintains feature flags differently than whatever revision of the driver these patches were generated against.

A message that is not in the archive (sent off-list or not yet received): 20090726.094402.38463748.davem-fT/PcQaiUtIeIZ0/[email protected]

#12 lore raw

Re: [net-next-2.6 PATCH 5/5] fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs)

Quoted 18 lines

Subject: Re: [Open-FCoE] [net-next-2.6 PATCH 5/5] fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs)

From: Robert Love <[email protected]>
Date: Thu, 23 Jul 2009 11:48:03 -0700

Quoted 6 lines

Yes, absolutely, but it's only this small patch that creates the dependency. I figured that all of the other fcoe patches could go into James' scsi-misc tree and get merged first. Then this one could go into his scsi-post-merge tree and depend on net-next.

It's really up to you and James, I just thought that would be easier.

So I tried to apply just the networking bits but none of the ixgbe parts apply properly to net-next-2.6, so this patch series will need to be respun and resubmitted in it's entirety so I can apply it properly.

Quoted 7 lines

It seems that the ixgbe driver now maintains feature flags differently than whatever revision of the driver these patches were generated against.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Thanks, I will go back and update these patches to sync w/ the current net-next-2.6. There seem to be patches in net-next-2.6 from net-2.6 after rebasing which were not there at the time these patches were submitted.

Thanks,

yi