Re: [PATCH] pktgen: Clone skb to avoid corruption of skbs in ndo_start_xmit methods
From: Neil Horman <nhorman@tuxdriver.com>
Date: 2011-07-20 15:40:07
On Wed, Jul 20, 2011 at 05:30:17PM +0200, Eric Dumazet wrote:
Le mercredi 20 juillet 2011 à 11:18 -0400, Neil Horman a écrit :quoted
On Wed, Jul 20, 2011 at 06:24:15AM +0200, Eric Dumazet wrote:quoted
Le mardi 19 juillet 2011 à 22:07 -0400, Neil Horman a écrit :quoted
quoted
I think this is a good idea. It lets pktgen dynamically make the clone/share decision dynamically and only impacts performance for those systems.Just let pktgen refuse to use clone_skb command for these devices.copy that, This is by no means final, but what do you think of this? If its agreeable to you, Ben, et al. I can add this to my local tree and start auditing all the drivers that may need to have the flag set. Regards Neildiff --git a/include/linux/if.h b/include/linux/if.h index 3bc63e6..ae904fe 100644 --- a/include/linux/if.h +++ b/include/linux/if.h@@ -76,6 +76,7 @@ #define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */ #define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch * datapath port */ +#define IFF_CANT_SHARE_SKB 0x10000 /* Device can't share skbs in tx path */ #define IF_GET_IFACE 0x0001 /* for querying only */ #define IF_GET_PROTO 0x0002diff --git a/net/core/pktgen.c b/net/core/pktgen.c index f76079c..bf6d88d 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c@@ -1071,6 +1071,9 @@ static ssize_t pktgen_if_write(struct file *file, if (len < 0) return len; + if (pkt_dev->priv_flags & IFF_CANT_SHARE_SKB) + return -EOPNOTSUPP; +Well, the general idea was to intercept the "clone_skb XXX" command and cap XXX to 0 for said devices.
Isn't that exactly what this does? Disallows a user from issuing the cone_skb command in a pktgen script if the underlying driver can't support the sharing of skbs.
So some admin can still use pktgen without clone_skb stuff.
Yes. this doesn't preclude that unless you see something I dont Neil