Message ID | 1298914061.5034.996.camel@zakaz.uk.xensource.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On Mon, 2011-02-28 at 17:27 +0000, Ian Campbell wrote: > The following patch is the third iteration of the Xen network backend > driver for upstream Linux. > > This driver ("netback") is the host side counterpart to the frontend > driver in drivers/net/xen-netfront.c. The PV protocol is also > implemented by frontend drivers in other OSes too, such as the BSDs and > even Windows. > > Since this is the third posting I think it is time I started posting > actual pull requests. The complete patch is still appended for ease of > review. [...] > --- /dev/null > +++ b/drivers/net/xen-netback/common.h [...] > + /* Statistics */ > + int rx_gso_checksum_fixup; This should be defined as unsigned long (ideally it would be u64, but that can't be updated atomically on 32-bit systems). [...] > --- /dev/null > +++ b/drivers/net/xen-netback/interface.c [...] > +void xenvif_receive_skb(struct xenvif *vif, struct sk_buff *skb) > +{ > + netif_rx_ni(skb); > + vif->dev->last_rx = jiffies; > +} Don't update last_rx; it's only needed on slave devices of a bond, and the bonding driver takes care of it now. [...] > +static int xenvif_change_mtu(struct net_device *dev, int mtu) > +{ > + struct xenvif *vif = netdev_priv(dev); > + int max = vif->can_sg ? 65535 - ETH_HLEN : ETH_DATA_LEN; > + if (mtu > max) > + return -EINVAL; > + dev->mtu = mtu; > + return 0; > +} [...] Since any VLAN tag must be inserted inline, shouldn't the MTU limit be 65535 - VLAN_ETH_HLEN? Ben.
On Mon, 2011-02-28 at 18:53 +0000, Ben Hutchings wrote: > On Mon, 2011-02-28 at 17:27 +0000, Ian Campbell wrote: > This should be defined as unsigned long (ideally it would be u64, but > that can't be updated atomically on 32-bit systems). [...] > Don't update last_rx; it's only needed on slave devices of a bond, and > the bonding driver takes care of it now. I made these two changes. > [...] > > +static int xenvif_change_mtu(struct net_device *dev, int mtu) > > +{ > > + struct xenvif *vif = netdev_priv(dev); > > + int max = vif->can_sg ? 65535 - ETH_HLEN : ETH_DATA_LEN; > > + if (mtu > max) > > + return -EINVAL; > > + dev->mtu = mtu; > > + return 0; > > +} > [...] > > Since any VLAN tag must be inserted inline, shouldn't the MTU limit be > 65535 - VLAN_ETH_HLEN? In that case shouldn't the other case also be ETH_FRAME_LEN - VLAN_ETH_HLEN? I'm not sure what is customary wrt MTU vs VLAN (or other) overheads under Linux, do we take the hit of the overhead for every device regardless of VLAN being configured or not or do we expect that people will configure the MTU as necessary when they configure a VLAN? Netback itself will cope fine with either MTU, it's the external connectivity which will actually matter. e.g. the usual configuration would be (where vifX.Y represents potentially multiple netback devices): eth0 <-> eth0.VLAN <-> br0.VLAN <=> vifX.Y So ultimately it will be the eth0 hardware/driver which matters. There is a comment in net/8021q/vlan.c which says /* need 4 bytes for extra VLAN header info, * hope the underlying device can handle it. */ and propagates the underlying device's MTU unmodified so it seems that the norm is to leave the MTU at maximum assuming no VLAN overhead and defer any required tweaking to the admin? Alternatively you might have the VLAN on the eth0 device inside the guest (e.g. netback<->netfront acts like a trunk link) in which case basically the same argument applies? I don't really mind either way so I'm happy to follow whatever the convention is. Ian. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, 2011-03-01 at 10:06 +0000, Ian Campbell wrote: > On Mon, 2011-02-28 at 18:53 +0000, Ben Hutchings wrote: > > On Mon, 2011-02-28 at 17:27 +0000, Ian Campbell wrote: > > > This should be defined as unsigned long (ideally it would be u64, but > > that can't be updated atomically on 32-bit systems). > [...] > > Don't update last_rx; it's only needed on slave devices of a bond, and > > the bonding driver takes care of it now. > > I made these two changes. > > > [...] > > > +static int xenvif_change_mtu(struct net_device *dev, int mtu) > > > +{ > > > + struct xenvif *vif = netdev_priv(dev); > > > + int max = vif->can_sg ? 65535 - ETH_HLEN : ETH_DATA_LEN; > > > + if (mtu > max) > > > + return -EINVAL; > > > + dev->mtu = mtu; > > > + return 0; > > > +} > > [...] > > > > Since any VLAN tag must be inserted inline, shouldn't the MTU limit be > > 65535 - VLAN_ETH_HLEN? > > In that case shouldn't the other case also be ETH_FRAME_LEN - > VLAN_ETH_HLEN? [...] IEEE 802.3, in its infinite wisdom, says that the maximum frame length is 1514, except that when an 802.1q tag is present it is 1518. So the MTU for standard Ethernet remains 1500, regardless of the use of VLANs. Ben.