ia64/xen-unstable

changeset 8179:a21cbe9a111b

Clean up netif messages. Remove bitfields, and create
extensible flag fields in tx requests and rx responses, in
place of specific csum_blank/csum_valid bitfields.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Dec 02 13:10:25 2005 +0100 (2005-12-02)
parents de95bab19b18
children df68a9433492
files linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c xen/include/public/io/netif.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Fri Dec 02 11:10:01 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Fri Dec 02 13:10:25 2005 +0100
     1.3 @@ -25,7 +25,7 @@ static int  make_rx_response(netif_t *ne
     1.4                               s8       st,
     1.5                               u16      offset,
     1.6                               u16      size,
     1.7 -                             u16      csum_valid);
     1.8 +                             u16      flags);
     1.9  
    1.10  static void net_tx_action(unsigned long unused);
    1.11  static DECLARE_TASKLET(net_tx_tasklet, net_tx_action, 0);
    1.12 @@ -301,7 +301,8 @@ static void net_rx_action(unsigned long 
    1.13  		id = RING_GET_REQUEST(&netif->rx, netif->rx.rsp_prod_pvt)->id;
    1.14  		if (make_rx_response(netif, id, status,
    1.15  				     (unsigned long)skb->data & ~PAGE_MASK,
    1.16 -				     size, skb->proto_csum_valid) &&
    1.17 +				     size, skb->proto_csum_valid ?
    1.18 +				     NETRXF_csum_valid : 0) &&
    1.19  		    (rx_notify[irq] == 0)) {
    1.20  			rx_notify[irq] = 1;
    1.21  			notify_list[notify_nr++] = irq;
    1.22 @@ -632,7 +633,7 @@ static void net_tx_action(unsigned long 
    1.23                   */
    1.24  		skb->ip_summed        = CHECKSUM_UNNECESSARY;
    1.25  		skb->proto_csum_valid = 1;
    1.26 -		skb->proto_csum_blank = txreq.csum_blank;
    1.27 +		skb->proto_csum_blank = !!(txreq.flags & NETTXF_csum_blank);
    1.28  
    1.29  		netif->stats.rx_bytes += txreq.size;
    1.30  		netif->stats.rx_packets++;
    1.31 @@ -706,7 +707,7 @@ static int make_rx_response(netif_t *net
    1.32                              s8       st,
    1.33                              u16      offset,
    1.34                              u16      size,
    1.35 -                            u16      csum_valid)
    1.36 +                            u16      flags)
    1.37  {
    1.38  	RING_IDX i = netif->rx.rsp_prod_pvt;
    1.39  	netif_rx_response_t *resp;
    1.40 @@ -714,7 +715,7 @@ static int make_rx_response(netif_t *net
    1.41  
    1.42  	resp = RING_GET_RESPONSE(&netif->rx, i);
    1.43  	resp->offset     = offset;
    1.44 -	resp->csum_valid = csum_valid;
    1.45 +	resp->flags      = flags;
    1.46  	resp->id         = id;
    1.47  	resp->status     = (s16)size;
    1.48  	if (st < 0)
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Fri Dec 02 11:10:01 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Fri Dec 02 13:10:25 2005 +0100
     2.3 @@ -660,7 +660,7 @@ static int network_start_xmit(struct sk_
     2.4  	tx->gref = np->grant_tx_ref[id] = ref;
     2.5  	tx->offset = (unsigned long)skb->data & ~PAGE_MASK;
     2.6  	tx->size = skb->len;
     2.7 -	tx->csum_blank = (skb->ip_summed == CHECKSUM_HW);
     2.8 +	tx->flags = (skb->ip_summed == CHECKSUM_HW) ? NETTXF_csum_blank : 0;
     2.9  
    2.10  	np->tx.req_prod_pvt = i + 1;
    2.11  	RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&np->tx, notify);
    2.12 @@ -775,7 +775,7 @@ static int netif_poll(struct net_device 
    2.13  		skb->len  = rx->status;
    2.14  		skb->tail = skb->data + skb->len;
    2.15  
    2.16 -		if ( rx->csum_valid )
    2.17 +		if ( rx->flags & NETRXF_csum_valid )
    2.18  			skb->ip_summed = CHECKSUM_UNNECESSARY;
    2.19  
    2.20  		np->stats.rx_packets++;
    2.21 @@ -957,7 +957,8 @@ static void network_connect(struct net_d
    2.22  		tx->gref = np->grant_tx_ref[i];
    2.23  		tx->offset = (unsigned long)skb->data & ~PAGE_MASK;
    2.24  		tx->size = skb->len;
    2.25 -		tx->csum_blank = (skb->ip_summed == CHECKSUM_HW);
    2.26 +		tx->flags = (skb->ip_summed == CHECKSUM_HW) ?
    2.27 +			NETTXF_csum_blank : 0;
    2.28  
    2.29  		np->stats.tx_bytes += skb->len;
    2.30  		np->stats.tx_packets++;
     3.1 --- a/xen/include/public/io/netif.h	Fri Dec 02 11:10:01 2005 +0100
     3.2 +++ b/xen/include/public/io/netif.h	Fri Dec 02 13:10:25 2005 +0100
     3.3 @@ -18,17 +18,21 @@
     3.4   * or rsp_event field in the shared ring.
     3.5   */
     3.6  
     3.7 +/* Protocol checksum field is blank in the packet (hardware offload)? */
     3.8 +#define _NETTXF_csum_blank (0)
     3.9 +#define  NETTXF_csum_blank (1U<<_NETTXF_csum_blank)
    3.10 +
    3.11  typedef struct netif_tx_request {
    3.12      grant_ref_t gref;      /* Reference to buffer page */
    3.13 -    uint16_t offset:15;    /* Offset within buffer page */
    3.14 -    uint16_t csum_blank:1; /* Proto csum field blank?   */
    3.15 +    uint16_t offset;       /* Offset within buffer page */
    3.16 +    uint16_t flags;        /* NETTXF_* */
    3.17      uint16_t id;           /* Echoed in response message. */
    3.18      uint16_t size;         /* Packet size in bytes.       */
    3.19  } netif_tx_request_t;
    3.20  
    3.21  typedef struct netif_tx_response {
    3.22      uint16_t id;
    3.23 -    int8_t   status;
    3.24 +    int16_t  status;       /* NETIF_RSP_* */
    3.25  } netif_tx_response_t;
    3.26  
    3.27  typedef struct {
    3.28 @@ -36,11 +40,15 @@ typedef struct {
    3.29      grant_ref_t gref;      /* Reference to incoming granted frame */
    3.30  } netif_rx_request_t;
    3.31  
    3.32 +/* Protocol checksum already validated (e.g., performed by hardware)? */
    3.33 +#define _NETRXF_csum_valid (0)
    3.34 +#define  NETRXF_csum_valid (1U<<_NETRXF_csum_valid)
    3.35 +
    3.36  typedef struct {
    3.37 -    uint16_t offset;     /* Offset in page of start of received packet  */
    3.38 -    uint16_t csum_valid; /* Protocol checksum is validated?       */
    3.39      uint16_t id;
    3.40 -    int16_t  status;     /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
    3.41 +    uint16_t offset;       /* Offset in page of start of received packet  */
    3.42 +    uint16_t flags;        /* NETRXF_* */
    3.43 +    int16_t  status;       /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
    3.44  } netif_rx_response_t;
    3.45  
    3.46  /*