From patchwork Wed Jul 20 15:18:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Neil Horman X-Patchwork-Id: 105749 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42032B6F71 for ; Thu, 21 Jul 2011 01:18:52 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751508Ab1GTPSr (ORCPT ); Wed, 20 Jul 2011 11:18:47 -0400 Received: from charlotte.tuxdriver.com ([70.61.120.58]:40449 "EHLO smtp.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751006Ab1GTPSr (ORCPT ); Wed, 20 Jul 2011 11:18:47 -0400 Received: from hmsreliant.think-freely.org ([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1QjYXc-00058J-FU; Wed, 20 Jul 2011 11:18:42 -0400 Date: Wed, 20 Jul 2011 11:18:27 -0400 From: Neil Horman To: Eric Dumazet Cc: Ben Greear , Jiri Pirko , netdev@vger.kernel.org, Alexey Dobriyan , "David S. Miller" , robert.olsson@its.uu.se Subject: Re: [PATCH] pktgen: Clone skb to avoid corruption of skbs in ndo_start_xmit methods Message-ID: <20110720151827.GD12349@hmsreliant.think-freely.org> References: <1311105179-26408-1-git-send-email-nhorman@tuxdriver.com> <1311105738.3113.11.camel@edumazet-laptop> <20110719202922.GA2352@minipsycho> <1311108107.3113.22.camel@edumazet-laptop> <20110720001904.GA1992@neilslaptop.think-freely.org> <1311122593.3113.46.camel@edumazet-laptop> <4E2626E1.6030005@candelatech.com> <20110720020737.GB2692@neilslaptop.think-freely.org> <1311135855.3113.66.camel@edumazet-laptop> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1311135855.3113.66.camel@edumazet-laptop> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.1 (--) X-Spam-Status: No Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Jul 20, 2011 at 06:24:15AM +0200, Eric Dumazet wrote: > Le mardi 19 juillet 2011 à 22:07 -0400, Neil Horman a écrit : > > > > > 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 Neil --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --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 0x0002 diff --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; + i += len; pkt_dev->clone_skb = value;