public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Robert Shearman <rshearma@brocade•com>
To: Francois Romieu <romieu@fr•zoreil.com>
Cc: <davem@davemloft•net>, <netdev@vger•kernel.org>,
	Roopa Prabhu <roopa@cumulusnetworks•com>,
	"Eric W. Biederman" <ebiederm@xmission•com>
Subject: Re: [PATCH net-next 1/2] mpls: packet stats
Date: Mon, 8 Feb 2016 16:17:51 +0000	[thread overview]
Message-ID: <56B8BFAF.3040505@brocade.com> (raw)
In-Reply-To: <20160206105843.GA27535@electric-eye.fr.zoreil.com>

On 06/02/16 10:58, Francois Romieu wrote:
> Robert Shearman <rshearma@brocade•com> :
> [...]
>> diff --git a/net/mpls/Makefile b/net/mpls/Makefile
>> index 9ca923625016..6fdd61b9eae3 100644
>> --- a/net/mpls/Makefile
>> +++ b/net/mpls/Makefile
> [...]
>> @@ -98,6 +94,29 @@ bool mpls_pkt_too_big(const struct sk_buff *skb, unsigned int mtu)
>>   }
>>   EXPORT_SYMBOL_GPL(mpls_pkt_too_big);
>>
>> +void mpls_stats_inc_outucastpkts(struct net_device *dev,
>> +				 const struct sk_buff *skb)
>> +{
>> +	struct mpls_dev *mdev;
>> +	struct inet6_dev *in6dev;
>
> Nit: the scope can be reduced for both variables.

I'm happy to change this if this is the recommended style, but David 
Laight's reply suggests some doubt.

>
>> +
>> +	if (skb->protocol == htons(ETH_P_MPLS_UC)) {
>> +		mdev = mpls_dev_get(dev);
>> +		if (mdev)
>> +			MPLS_INC_STATS_LEN(mdev, skb->len,
>> +					   MPLS_IFSTATS_MIB_OUTUCASTPKTS,
>> +					   MPLS_IFSTATS_MIB_OUTOCTETS);
>> +	} else if (skb->protocol == htons(ETH_P_IP)) {
>> +		IP_UPD_PO_STATS(dev_net(dev), IPSTATS_MIB_OUT, skb->len);
>> +	} else if (skb->protocol == htons(ETH_P_IPV6)) {
>> +		in6dev = __in6_dev_get(dev);
>> +		if (in6dev)
>> +			IP6_UPD_PO_STATS(dev_net(dev), in6dev,
>> +					 IPSTATS_MIB_OUT, skb->len);
>> +	}
>> +}
> [...]
>> diff --git a/net/mpls/internal.h b/net/mpls/internal.h
>> index 732a5c17e986..b39770ff2307 100644
>> --- a/net/mpls/internal.h
>> +++ b/net/mpls/internal.h
> [...]
>> +#define MPLS_INC_STATS(mdev, field)					\
>> +	do {								\
>> +		__typeof__(*(mdev)->stats) *ptr =			\
>> +			raw_cpu_ptr((mdev)->stats);			\
>> +		local_bh_disable();					\
>> +		u64_stats_update_begin(&ptr->syncp);			\
>> +		ptr->mib[field]++;					\
>> +		u64_stats_update_end(&ptr->syncp);			\
>> +		local_bh_enable();					\
>> +	} while (0)
>
> I don't get the point of the local_bh_{disable / enable}.
>
> Which kind of locally enabled bh code section do you anticipate these
> helpers to run under ?

When a user process sends an IPv4/IPv6 packet destined to a route with 
mpls lwt encap.

Thanks,
Rob

  parent reply	other threads:[~2016-02-08 16:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-05 19:27 [PATCH net-next 0/2] mpls: packet stats and ttl propagation config Robert Shearman
2016-02-05 19:27 ` [PATCH net-next 1/2] mpls: packet stats Robert Shearman
2016-02-06 10:58   ` Francois Romieu
2016-02-08 11:51     ` David Laight
2016-02-16 20:08       ` David Miller
2016-02-08 16:17     ` Robert Shearman [this message]
2016-02-16 15:41   ` David Miller
2016-02-16 20:26     ` roopa
2016-02-19  9:57       ` Robert Shearman
2016-07-29  5:19   ` Roopa Prabhu
2016-02-05 19:27 ` [PATCH net-next 2/2] mpls: allow TTL propagation to/from IP packets to be configured Robert Shearman
2016-02-06 18:36   ` Eric W. Biederman
2016-02-09 16:10     ` Robert Shearman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56B8BFAF.3040505@brocade.com \
    --to=rshearma@brocade$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=ebiederm@xmission$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=romieu@fr$(echo .)zoreil.com \
    --cc=roopa@cumulusnetworks$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox