[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Clean up netif messages. Remove bitfields, and create



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID a21cbe9a111b58b3092db6c95a068679feba077b
# Parent  de95bab19b1880e2645dcc67684560616f13d6af
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@xxxxxxxxxxxxx>

diff -r de95bab19b18 -r a21cbe9a111b 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Fri Dec  2 
10:10:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Fri Dec  2 
12:10:25 2005
@@ -25,7 +25,7 @@
                              s8       st,
                              u16      offset,
                              u16      size,
-                             u16      csum_valid);
+                             u16      flags);
 
 static void net_tx_action(unsigned long unused);
 static DECLARE_TASKLET(net_tx_tasklet, net_tx_action, 0);
@@ -301,7 +301,8 @@
                id = RING_GET_REQUEST(&netif->rx, netif->rx.rsp_prod_pvt)->id;
                if (make_rx_response(netif, id, status,
                                     (unsigned long)skb->data & ~PAGE_MASK,
-                                    size, skb->proto_csum_valid) &&
+                                    size, skb->proto_csum_valid ?
+                                    NETRXF_csum_valid : 0) &&
                    (rx_notify[irq] == 0)) {
                        rx_notify[irq] = 1;
                        notify_list[notify_nr++] = irq;
@@ -632,7 +633,7 @@
                  */
                skb->ip_summed        = CHECKSUM_UNNECESSARY;
                skb->proto_csum_valid = 1;
-               skb->proto_csum_blank = txreq.csum_blank;
+               skb->proto_csum_blank = !!(txreq.flags & NETTXF_csum_blank);
 
                netif->stats.rx_bytes += txreq.size;
                netif->stats.rx_packets++;
@@ -706,7 +707,7 @@
                             s8       st,
                             u16      offset,
                             u16      size,
-                            u16      csum_valid)
+                            u16      flags)
 {
        RING_IDX i = netif->rx.rsp_prod_pvt;
        netif_rx_response_t *resp;
@@ -714,7 +715,7 @@
 
        resp = RING_GET_RESPONSE(&netif->rx, i);
        resp->offset     = offset;
-       resp->csum_valid = csum_valid;
+       resp->flags      = flags;
        resp->id         = id;
        resp->status     = (s16)size;
        if (st < 0)
diff -r de95bab19b18 -r a21cbe9a111b 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Fri Dec  2 
10:10:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Fri Dec  2 
12:10:25 2005
@@ -660,7 +660,7 @@
        tx->gref = np->grant_tx_ref[id] = ref;
        tx->offset = (unsigned long)skb->data & ~PAGE_MASK;
        tx->size = skb->len;
-       tx->csum_blank = (skb->ip_summed == CHECKSUM_HW);
+       tx->flags = (skb->ip_summed == CHECKSUM_HW) ? NETTXF_csum_blank : 0;
 
        np->tx.req_prod_pvt = i + 1;
        RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&np->tx, notify);
@@ -775,7 +775,7 @@
                skb->len  = rx->status;
                skb->tail = skb->data + skb->len;
 
-               if ( rx->csum_valid )
+               if ( rx->flags & NETRXF_csum_valid )
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
 
                np->stats.rx_packets++;
@@ -957,7 +957,8 @@
                tx->gref = np->grant_tx_ref[i];
                tx->offset = (unsigned long)skb->data & ~PAGE_MASK;
                tx->size = skb->len;
-               tx->csum_blank = (skb->ip_summed == CHECKSUM_HW);
+               tx->flags = (skb->ip_summed == CHECKSUM_HW) ?
+                       NETTXF_csum_blank : 0;
 
                np->stats.tx_bytes += skb->len;
                np->stats.tx_packets++;
diff -r de95bab19b18 -r a21cbe9a111b xen/include/public/io/netif.h
--- a/xen/include/public/io/netif.h     Fri Dec  2 10:10:01 2005
+++ b/xen/include/public/io/netif.h     Fri Dec  2 12:10:25 2005
@@ -18,17 +18,21 @@
  * or rsp_event field in the shared ring.
  */
 
+/* Protocol checksum field is blank in the packet (hardware offload)? */
+#define _NETTXF_csum_blank (0)
+#define  NETTXF_csum_blank (1U<<_NETTXF_csum_blank)
+
 typedef struct netif_tx_request {
     grant_ref_t gref;      /* Reference to buffer page */
-    uint16_t offset:15;    /* Offset within buffer page */
-    uint16_t csum_blank:1; /* Proto csum field blank?   */
+    uint16_t offset;       /* Offset within buffer page */
+    uint16_t flags;        /* NETTXF_* */
     uint16_t id;           /* Echoed in response message. */
     uint16_t size;         /* Packet size in bytes.       */
 } netif_tx_request_t;
 
 typedef struct netif_tx_response {
     uint16_t id;
-    int8_t   status;
+    int16_t  status;       /* NETIF_RSP_* */
 } netif_tx_response_t;
 
 typedef struct {
@@ -36,11 +40,15 @@
     grant_ref_t gref;      /* Reference to incoming granted frame */
 } netif_rx_request_t;
 
+/* Protocol checksum already validated (e.g., performed by hardware)? */
+#define _NETRXF_csum_valid (0)
+#define  NETRXF_csum_valid (1U<<_NETRXF_csum_valid)
+
 typedef struct {
-    uint16_t offset;     /* Offset in page of start of received packet  */
-    uint16_t csum_valid; /* Protocol checksum is validated?       */
     uint16_t id;
-    int16_t  status;     /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
+    uint16_t offset;       /* Offset in page of start of received packet  */
+    uint16_t flags;        /* NETRXF_* */
+    int16_t  status;       /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
 } netif_rx_response_t;
 
 /*

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.