Skip to contentSkip to conversation

netdevice.h: Add a new zerocopy device flag

PATCH Superseded Shirley Ma 1 participant 2 messages May 4, 2011 – May 5, 2011 1 message not in the archive

Subsystems (3)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Shirley Ma

author
#0 lore raw

PATCH v4 2/8 netdevice.h: Add a new zerocopy device flag

---

 include/linux/netdevice.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
include/linux/netdevice.h +10 -0
index 0249fe7..0808f1e 100644
@@ -1067,6 +1067,16 @@ struct net_device {
 #define NETIF_F_RXHASH		(1 << 28) /* Receive hashing offload */
 #define NETIF_F_RXCSUM		(1 << 29) /* Receive checksumming offload */
 
+/*
+ * Bit 31 is for device to map userspace buffers -- zerocopy
+ * Device can set this flag when it supports HIGHDMA.
+ * Device can't recycle this kind of skb buffers.
+ * There are 256 bytes copied, the rest of buffers are mapped.
+ * The userspace callback should only be called when last reference to this skb
+ * is gone.
+ */
+#define NETIF_F_ZEROCOPY	(1 << 31)
+
 	/* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT	16
 #define NETIF_F_GSO_MASK	0x00ff0000
author
#2 lore raw
In reply to a message not in the archive
Quoted 28 lines · Sridhar Samudrala
Quoted 14 lines · Shirley Ma

---

 include/linux/netdevice.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
include/linux/netdevice.h +0 -0
index 0249fe7..0808f1e 100644
@@ -1067,6 +1067,16 @@ struct net_device {
 #define NETIF_F_RXHASH		(1 << 28) /* Receive hashing offload */
 #define NETIF_F_RXCSUM		(1 << 29) /* Receive checksumming offload */
 

include/linux/netdevice.h struct net_device { · line 1079

Quoted 10 lines
include/linux/netdevice.h +10 -0
+/*
+ * Bit 31 is for device to map userspace buffers -- zerocopy
+ * Device can set this flag when it supports HIGHDMA.
+ * Device can't recycle this kind of skb buffers.
+ * There are 256 bytes copied, the rest of buffers are mapped.
+ * The userspace callback should only be called when last reference to this skb
+ * is gone.
+ */
+#define NETIF_F_ZEROCOPY	(1 << 31)
+

Should we make this TX_ZEROCOPY as we may need a seperate flag for RX_ZEROCOPY in future?

Quoted 1 line

Same with socket flag.

We might be able to use the same flag for both TX and RX. If RX zero-copy requires only HIGHDMA feature only. If not, then we might need different feature bit. Same for sock flag.

Quoted 4 lines

Thanks
Sridhar