debuggers.hg
changeset 10917:5379548bfc79
[NET] Enable TCPv4 segmentation offload in front/back drivers.
Signed-off-by: Keir Fraser <keir@xensource.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kfraser@localhost.localdomain |
---|---|
date | Tue Aug 01 11:54:45 2006 +0100 (2006-08-01) |
parents | 947e09f90b3b |
children | d8d66e2c19b2 |
files | linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c |
line diff
1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Mon Jul 31 18:12:53 2006 +0100 1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Tue Aug 01 11:54:45 2006 +0100 1.3 @@ -221,13 +221,20 @@ static struct sk_buff *netbk_copy_skb(st 1.4 return NULL; 1.5 } 1.6 1.7 +static inline int netbk_max_required_rx_slots(netif_t *netif) 1.8 +{ 1.9 + if (netif->features & (NETIF_F_SG|NETIF_F_TSO)) 1.10 + return MAX_SKB_FRAGS + 2; /* header + extra_info + frags */ 1.11 + return 1; /* all in one */ 1.12 +} 1.13 + 1.14 static inline int netbk_queue_full(netif_t *netif) 1.15 { 1.16 - RING_IDX peek = netif->rx_req_cons_peek; 1.17 + RING_IDX peek = netif->rx_req_cons_peek; 1.18 + RING_IDX needed = netbk_max_required_rx_slots(netif); 1.19 1.20 - return ((netif->rx.sring->req_prod - peek) <= (MAX_SKB_FRAGS + 1)) || 1.21 - ((netif->rx.rsp_prod_pvt + NET_RX_RING_SIZE - peek) <= 1.22 - (MAX_SKB_FRAGS + 1)); 1.23 + return ((netif->rx.sring->req_prod - peek) < needed) || 1.24 + ((netif->rx.rsp_prod_pvt + NET_RX_RING_SIZE - peek) < needed); 1.25 } 1.26 1.27 int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev) 1.28 @@ -271,7 +278,7 @@ int netif_be_start_xmit(struct sk_buff * 1.29 1.30 if (netbk_can_queue(dev) && netbk_queue_full(netif)) { 1.31 netif->rx.sring->req_event = netif->rx_req_cons_peek + 1.32 - MAX_SKB_FRAGS + 2; 1.33 + netbk_max_required_rx_slots(netif); 1.34 mb(); /* request notification /then/ check & stop the queue */ 1.35 if (netbk_queue_full(netif)) 1.36 netif_stop_queue(dev);
2.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Mon Jul 31 18:12:53 2006 +0100 2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Tue Aug 01 11:54:45 2006 +0100 2.3 @@ -101,14 +101,12 @@ static int netback_probe(struct xenbus_d 2.4 goto abort_transaction; 2.5 } 2.6 2.7 -#if 0 /* KAF: After the protocol is finalised. */ 2.8 err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv4", 2.9 "%d", 1); 2.10 if (err) { 2.11 message = "writing feature-gso-tcpv4"; 2.12 goto abort_transaction; 2.13 } 2.14 -#endif 2.15 2.16 err = xenbus_transaction_end(xbt, 0); 2.17 } while (err == -EAGAIN); 2.18 @@ -384,7 +382,6 @@ static int connect_rings(struct backend_ 2.19 be->netif->dev->features |= NETIF_F_SG; 2.20 } 2.21 2.22 -#if 0 /* KAF: After the protocol is finalised. */ 2.23 if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv4", "%d", 2.24 &val) < 0) 2.25 val = 0; 2.26 @@ -392,7 +389,6 @@ static int connect_rings(struct backend_ 2.27 be->netif->features |= NETIF_F_TSO; 2.28 be->netif->dev->features |= NETIF_F_TSO; 2.29 } 2.30 -#endif 2.31 2.32 /* Map the shared frame, irq etc. */ 2.33 err = netif_map(be->netif, tx_ring_ref, rx_ring_ref, evtchn);
3.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Mon Jul 31 18:12:53 2006 +0100 3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Tue Aug 01 11:54:45 2006 +0100 3.3 @@ -338,13 +338,11 @@ again: 3.4 goto abort_transaction; 3.5 } 3.6 3.7 -#if 0 /* KAF: After the protocol is finalised. */ 3.8 err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv4", "%d", 1); 3.9 if (err) { 3.10 message = "writing feature-gso-tcpv4"; 3.11 goto abort_transaction; 3.12 } 3.13 -#endif 3.14 3.15 err = xenbus_transaction_end(xbt, 0); 3.16 if (err) { 3.17 @@ -1327,9 +1325,7 @@ static int xennet_set_tso(struct net_dev 3.18 if (xenbus_scanf(XBT_NIL, np->xbdev->otherend, 3.19 "feature-gso-tcpv4", "%d", &val) < 0) 3.20 val = 0; 3.21 -#if 0 /* KAF: After the protocol is finalised. */ 3.22 if (!val) 3.23 -#endif 3.24 return -ENOSYS; 3.25 } 3.26