|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] netback: allow arbitrary mtu size until frontend connects
Allow arbitrary mtu size until the frontend is connected. Once the
connection is established, adjust mtu by checking if the backend
supports the 'feature-sg'. If the backend does support it, keep the
current mtu. Otherwise set it to the default value, which is 1500.
This helps the vif-bridge hotplug script to set the mtu size to 9000
while bringing up the guest.
Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
---
drivers/xen/netback/common.h | 8 ++++++++
drivers/xen/netback/interface.c | 8 +++++++-
drivers/xen/netback/xenbus.c | 9 +++++++++
3 files changed, 24 insertions(+), 1 deletion(-)
--- linux-2.6.18-xen.hg.orig/drivers/xen/netback/common.h
+++ linux-2.6.18-xen.hg/drivers/xen/netback/common.h
@@ -82,6 +82,8 @@ typedef struct netif_st {
u8 can_queue:1; /* can queue packets for receiver? */
u8 copying_receiver:1; /* copy packets to receiver? */
+ u8 frontend_connected:1; /* is frontend already connected? */
+
/* Allow netif_be_start_xmit() to peek ahead in the rx request ring. */
RING_IDX rx_req_cons_peek;
@@ -217,4 +219,10 @@ static inline int netbk_can_sg(struct ne
return netif->features & NETIF_F_SG;
}
+static inline int netbk_frontend_connected(struct net_device *dev)
+{
+ netif_t *netif = netdev_priv(dev);
+ return !!netif->frontend_connected;
+}
+
#endif /* __NETIF__BACKEND__COMMON_H__ */
--- linux-2.6.18-xen.hg.orig/drivers/xen/netback/interface.c
+++ linux-2.6.18-xen.hg/drivers/xen/netback/interface.c
@@ -83,9 +83,13 @@ static int net_close(struct net_device *
return 0;
}
+/* accept the max value if frontend is not yet connected */
static int netbk_change_mtu(struct net_device *dev, int mtu)
{
- int max = netbk_can_sg(dev) ? 65535 - ETH_HLEN : ETH_DATA_LEN;
+ int max = 65535 - ETH_HLEN;
+
+ if (netbk_frontend_connected(dev))
+ max = netbk_can_sg(dev) ? max : ETH_DATA_LEN;
if (mtu > max)
return -EINVAL;
@@ -359,6 +363,8 @@ err_rx:
void netif_disconnect(netif_t *netif)
{
+ netif->frontend_connected = 0;
+
if (netback_carrier_ok(netif)) {
rtnl_lock();
netback_carrier_off(netif);
--- linux-2.6.18-xen.hg.orig/drivers/xen/netback/xenbus.c
+++ linux-2.6.18-xen.hg/drivers/xen/netback/xenbus.c
@@ -329,6 +329,13 @@ static int xen_net_read_mac(struct xenbu
return 0;
}
+static void xen_net_adjust_mtu(netif_t *netif)
+{
+ if (!netif->dev->change_mtu)
+ return;
+ netif->dev->change_mtu(netif->dev, netif->dev->mtu);
+}
+
static void connect(struct backend_info *be)
{
int err;
@@ -338,6 +345,8 @@ static void connect(struct backend_info
if (err)
return;
+ be->netif->frontend_connected = 1;
+ xen_net_adjust_mtu(be->netif);
err = xen_net_read_mac(dev, be->netif->fe_dev_addr);
if (err) {
xenbus_dev_fatal(dev, err, "parsing %s/mac", dev->nodename);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |