netback fixes from XCP kernel tree
The following changes since commit c6f55dd4eb6ec8bdcfe221210a84907c496f6a75:
Jeremy Fitzhardinge (1):
xen/netback: include linux/sched.h for TASK_* definitions
are available in the git repository at:
git://xenbits.xensource.com/people/ianc/linux-2.6.git for-jeremy/netback
Ian Campbell (5):
xen: netback: remove unused xen_network_done code
xen: netback: factor disconnect from backend into new function.
xen: netback: wait for hotplug scripts to complete before signalling connected to frontend xen/netback: Always pull through PKT_PROT_LEN bytes into the linear part of an skb. xen/netback: Allow setting of large MTU before rings have connected.
Steven Smith (1):
xen/netback: try to pull a minimum of 72 bytes into the skb data area
drivers/xen/netback/common.h | 2 + drivers/xen/netback/interface.c | 6 +++- drivers/xen/netback/netback.c | 42 +++++++---------------- drivers/xen/netback/xenbus.c | 69 ++++++++++++++++++++++++++++++++++---- 4 files changed, 81 insertions(+), 38 deletions(-)
PATCH 1/6 xen: netback: remove unused xen_network_done code
It has been disabled effectively forever.
--- drivers/xen/netback/netback.c | 23 ----------------------- 1 files changed, 0 insertions(+), 23 deletions(-)
drivers/xen/netback/netback.c +0 -23
@@ -343,25 +343,6 @@ int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev)return 0 ; } -#if 0 -static void xen_network_done_notify (void ) -{ -static struct net_device *eth0_dev =NULL ; -if (unlikely (eth0_dev ==NULL )) - eth0_dev =__dev_get_by_name ("eth0" ); -netif_rx_schedule (eth0_dev); -} -/* -* Add following to poll() function in NAPI driver (Tigon3 is example): -* if ( xen_network_done() ) -* tg3_enable_ints(tp); -*/ -int xen_network_done (void ) -{ -return skb_queue_empty (&rx_queue); -} -#endif -struct netrx_pending_operations {unsigned trans_prod, trans_cons;unsigned mmu_prod, mmu_mcl;
@@ -676,10 +657,6 @@ static void net_rx_action(unsigned long unused)/* More work to do? */ if (!skb_queue_empty (&rx_queue) && !timer_pending (&net_timer))tasklet_schedule (&net_rx_tasklet); -#if 0 - else -xen_network_done_notify (); -#endif }static void net_alarm (unsigned long unused)
Signature · 1 line
1.5.6.5
PATCH 2/6 xen: netback: factor disconnect from backend into new function.
In reply to Ian CampbellMakes subsequent patches cleaner.
--- drivers/xen/netback/xenbus.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-)
drivers/xen/netback/xenbus.c +12 -4
@@ -213,6 +213,16 @@ static void backend_create_netif(struct backend_info *be) } +static void disconnect_backend (struct xenbus_device *dev) +{ +struct backend_info *be =dev_get_drvdata (&dev->dev); + +if (be->netif) { +netif_disconnect (be->netif); + be->netif =NULL ; + } +} +/** * Callback received when the frontend's state changes. */
@@ -246,11 +256,9 @@ static void frontend_changed(struct xenbus_device *dev,break ;case XenbusStateClosing: -if (be->netif) { +if (be->netif)kobject_uevent (&dev->dev.kobj,KOBJ_OFFLINE ); -netif_disconnect (be->netif); - be->netif =NULL ; - } +disconnect_backend (dev);xenbus_switch_state (dev, XenbusStateClosing);break ;
Signature · 1 line
1.5.6.5
PATCH 3/6 xen: netback: wait for hotplug scripts to complete before signalling connected to frontend
In reply to Ian CampbellAvoid the situation where the frontend is sending packets but the domain 0 bridging (or whatever) is not yet configured (because the hotplug scripts are too slow) and so packets get dropped.
--- drivers/xen/netback/common.h | 2 + drivers/xen/netback/xenbus.c | 45 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletions(-)
drivers/xen/netback/common.h +2 -0
@@ -147,6 +147,8 @@ struct backend_info {struct xenbus_device *dev;struct xen_netif *netif;enum xenbus_state frontend_state; +struct xenbus_watch hotplug_status_watch; + int have_hotplug_status_watch:1;/* State relating to the netback accelerator */ void *netback_accel_priv;
drivers/xen/netback/xenbus.c +44 -1
77 lines not on this page · raw message
Signature · 1 line
1.5.6.5
PATCH 4/6 xen/netback: Always pull through PKT_PROT_LEN bytes into the linear part of an skb.
In reply to Ian CampbellPreviously PKT_PROT_LEN would only have an effect on the first fragment.
--- drivers/xen/netback/netback.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/xen/netback/netback.c +10 -0
@@ -1346,6 +1346,16 @@ static void net_tx_submit(void)netbk_fill_frags (skb); +/* +* If the initial fragment was < PKT_PROT_LEN then +* pull through some bytes from the other fragments to +* increase the linear region to PKT_PROT_LEN bytes. +*/ +if (skb_headlen (skb) <PKT_PROT_LEN &&skb_is_nonlinear (skb)) { +int target =min_t (int, skb->len,PKT_PROT_LEN ); +__pskb_pull_tail (skb, target -skb_headlen (skb)); + } + skb->dev = netif->dev; skb->protocol =eth_type_trans (skb, skb->dev);
Signature · 1 line
1.5.6.5
Re: [PATCH 4/6] xen/netback: Always pull through PKT_PROT_LEN bytes into the linear part of an skb.
Could you point out what problem this addresses?
Thanks, Jan
Quoted 1 line
Quoted 1 line
Quoted 1 line
Ian Campbell <[email protected]> 23.02.10 17:47 >>>
Previously PKT_PROT_LEN would only have an effect on the first fragment.
--- drivers/xen/netback/netback.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/xen/netback/netback.c +10 -0
@@ -1346,6 +1346,16 @@ static void net_tx_submit(void)netbk_fill_frags (skb); +/* +* If the initial fragment was < PKT_PROT_LEN then +* pull through some bytes from the other fragments to +* increase the linear region to PKT_PROT_LEN bytes. +*/ +if (skb_headlen (skb) <PKT_PROT_LEN &&skb_is_nonlinear (skb)) { +int target =min_t (int, skb->len,PKT_PROT_LEN ); +__pskb_pull_tail (skb, target -skb_headlen (skb)); + } + skb->dev = netif->dev; skb->protocol =eth_type_trans (skb, skb->dev);
Signature · 7 lines
1.5.6.5 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xensource.com/xen-devel
Re: [PATCH 4/6] xen/netback: Always pull through PKT_PROT_LEN bytes into the linear part of an skb.
Quoted 1 line · Jan Beulich
Could you point out what problem this addresses?
It ensures that at least the TCP/IP headers will be pulled into the linear part of the SKB. At least skb_checksum_setup relies on this and I think it is a more generic assumption in at least some parts of the network stack as well. The next patch increases PKT_PROT_LEN to include the TCP options as well since we have observed cases where Windows guests with PV drivers can generate a frame with a split at the point.
In the common case the first fragment should already contain PKT_PROT_LEN bytes so I don't think it will trigger often.
Ian.
Quoted 32 lines
Thanks, Jan
Quoted 1 line
Quoted 1 line
Quoted 1 line
Ian Campbell <[email protected]> 23.02.10 17:47 >>>
Previously
PKT_PROT_LENwould only have an effect on the first fragment.Signed-off-by Ian Campbell <[email protected]>--- drivers/xen/netback/netback.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)drivers/xen/netback/netback.c +10
-0@@ -1346,6 +1346,16 @@ static void net_tx_submit(void)netbk_fill_frags (skb); +/* +* If the initial fragment was < PKT_PROT_LEN then +* pull through some bytes from the other fragments to +* increase the linear region to PKT_PROT_LEN bytes. +*/ +if (skb_headlen (skb) <PKT_PROT_LEN &&skb_is_nonlinear (skb)) { +int target =min_t (int, skb->len,PKT_PROT_LEN ); +__pskb_pull_tail (skb, target -skb_headlen (skb)); + } + skb->dev = netif->dev; skb->protocol =eth_type_trans (skb, skb->dev);
RE: [PATCH 4/6] xen/netback: Always pull throughPKT_PROT_LEN bytes into the linear part of an skb.
Quoted 6 lines · Jan Beulich
Quoted 1 line
Could you point out what problem this addresses?
It ensures that at least the TCP/IP headers will be pulled into the linear part of the SKB. At least
skb_checksum_setuprelies on this and
I
Quoted 2 lines
think it is a more generic assumption in at least some parts of the network stack as well. The next patch increases
PKT_PROT_LENto
include
Quoted 3 lines
the TCP options as well since we have observed cases where Windows guests with PV drivers can generate a frame with a split at the point.
My PV drivers couldn't always be relied on to do this, because Windows couldn't be relied on to do it either. I just coalesced the first buffer to some minimum value depending on the header type. If you are doing TCP checksum offload then you have to tell Windows that you support IP checksum offload too - Linux doesn't support that so you have to lie to Windows about it and calculate the IP checksum in the PV drivers, and if you are doing that you have to have your own copy of the header anyway so it turns out not to be a big deal.
James
RE: [PATCH 4/6] xen/netback: Always pull throughPKT_PROT_LEN bytes into the linear part of an skb.
Quoted 14 lines · James Harper
Quoted 6 lines · Jan Beulich
Quoted 1 line
Could you point out what problem this addresses?
It ensures that at least the TCP/IP headers will be pulled into the linear part of the SKB. At least
skb_checksum_setuprelies on this andI
Quoted 2 lines
think it is a more generic assumption in at least some parts of the network stack as well. The next patch increases
PKT_PROT_LENtoinclude
Quoted 3 lines
the TCP options as well since we have observed cases where Windows guests with PV drivers can generate a frame with a split at the point.
Quoted 8 lines
My PV drivers couldn't always be relied on to do this, because Windows couldn't be relied on to do it either. I just coalesced the first buffer to some minimum value depending on the header type. If you are doing TCP checksum offload then you have to tell Windows that you support IP checksum offload too - Linux doesn't support that so you have to lie to Windows about it and calculate the IP checksum in the PV drivers, and if you are doing that you have to have your own copy of the header anyway so it turns out not to be a big deal.
Yes, it's best if the guest takes care of this in the common case but domain 0 can't trust the guest so we need a backstop in netback too. If the guest is doing the sane thing the backstop shouldn't trigger.
Ian.
PATCH 5/6 xen/netback: try to pull a minimum of 72 bytes into the skb data area
In reply to Ian CampbellFrom: Steven Smith <[email protected]>
--- drivers/xen/netback/netback.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
drivers/xen/netback/netback.c +3 -6
@@ -116,13 +116,10 @@ static inline int netif_page_index(struct page *pg)/* * This is the amount of packet we copy rather than map, so that the * guest can't fiddle with the contents of the headers while we do -* packet processing on them (netfilter, routing, etc). This could -* probably do with being larger, since 1) 64-bytes isn't necessarily -* long enough to cover a full christmas-tree ip+tcp header, let alone -* packet contents, and 2) the data is probably in cache anyway -* (though perhaps some other cpu's cache). +* packet processing on them (netfilter, routing, etc). 72 is enough +* to cover TCP+IP headers including options. */ -#define PKT_PROT_LEN 64 +#define PKT_PROT_LEN 72 static struct pending_tx_info { struct xen_netif_tx_request req;
Signature · 1 line
1.5.6.5
Re: [PATCH 5/6] xen/netback: try to pull a minimum of 72 bytes into the skb data area
Something odd happened with git-formatpatch here, there was a commit message originally:
xen/netback: try to pull a minimum of 72 bytes into the skb data area when receiving a packet into netback. The previous number, 64, tended to place a fragment boundary in the middle of the TCP header options and led to unnecessary fragmentation in Windows <-> Windows networking.
Ian.
Quoted 27 lines · Ian Campbell
From: Steven Smith <[email protected]>
--- drivers/xen/netback/netback.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)drivers/xen/netback/netback.c +3
-6@@ -116,13 +116,10 @@ static inline int netif_page_index(struct page *pg)/* * This is the amount of packet we copy rather than map, so that the * guest can't fiddle with the contents of the headers while we do -* packet processing on them (netfilter, routing, etc). This could -* probably do with being larger, since 1) 64-bytes isn't necessarily -* long enough to cover a full christmas-tree ip+tcp header, let alone -* packet contents, and 2) the data is probably in cache anyway -* (though perhaps some other cpu's cache). +* packet processing on them (netfilter, routing, etc). 72 is enough +* to cover TCP+IP headers including options. */ -#define PKT_PROT_LEN 64 +#define PKT_PROT_LEN 72 static struct pending_tx_info { struct xen_netif_tx_request req;