netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Sabrina Dubroca <sd@queasysnail.net>, netdev@vger.kernel.org
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>,
	Florian Westphal <fw@strlen.de>, Paolo Abeni <pabeni@redhat.com>,
	stephen@networkplumber.org
Subject: Re: [PATCH net-next v2 3/3] macsec: introduce IEEE 802.1AE driver
Date: Tue, 15 Mar 2016 15:03:31 +0100	[thread overview]
Message-ID: <1458050611.2871.11.camel@sipsolutions.net> (raw)
In-Reply-To: <3d7ef45fa74b3bde47dabee3f23c8b8d04b546aa.1457714618.git.sd@queasysnail.net>

Hi,

> +struct macsec_rx_sa_stats {
> +	__u32 InPktsOK;
> +	__u32 InPktsInvalid;
> +	__u32 InPktsNotValid;
> +	__u32 InPktsNotUsingSA;
> +	__u32 InPktsUnusedSA;
> +};
> +
> +struct macsec_tx_sa_stats {
> +	__u32 OutPktsProtected;
> +	__u32 OutPktsEncrypted;
> +};

Just noticed this: is there a particular reason for using only __u32
here? The others all seem to use __u64.

> +static int macsec_dump_txsc(struct sk_buff *skb, struct
> netlink_callback *cb)
> +{
> +	struct net *net = sock_net(skb->sk);
> +	struct net_device *dev;
> +	int dev_idx, d;
> +
> +	dev_idx = cb->args[0];
> +
> +	d = 0;
> +	for_each_netdev(net, dev) {
> +		struct macsec_secy *secy;
> +
> +		if (d < dev_idx)
> +			goto next;
> +
> +		if (!netif_is_macsec(dev))
> +			goto next;
> +
> +		secy = &macsec_priv(dev)->secy;
> +		if (dump_secy(secy, dev, skb, cb) < 0)
> +			goto done;
> +next:
> +		d++;
> +	}
> +
> +done:
> +	cb->args[0] = d;
> +	return skb->len;
> +}

Maybe you should consider adding genl_dump_check_consistent() support
here, so userspace can figure out if the dump was really consistent, if
necessary.

To do this, you have to keep a global generation counter that changes
whenever this list changes (adding/removing macsec interfaces, I think)
and then set

	cb->seq = macsec_generation_counter;

at the beginning of this function, and call
genl_dump_check_consistent() for each message in the loop.

Btw, aren't you missing locking here for for_each_netdev()?

johannes

  reply	other threads:[~2016-03-15 14:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 17:07 [PATCH net-next v2 0/3] MACsec IEEE 802.1AE implementation Sabrina Dubroca
2016-03-11 17:07 ` [PATCH net-next v2 1/3] uapi: add MACsec bits Sabrina Dubroca
2016-03-11 17:07 ` [PATCH net-next v2 2/3] net: add MACsec netdevice priv_flags and helper Sabrina Dubroca
2016-03-11 17:07 ` [PATCH net-next v2 3/3] macsec: introduce IEEE 802.1AE driver Sabrina Dubroca
2016-03-15 14:03   ` Johannes Berg [this message]
2016-03-16  9:50     ` Sabrina Dubroca
2016-03-14  2:41 ` [PATCH net-next v2 0/3] MACsec IEEE 802.1AE implementation David Miller

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=1458050611.2871.11.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=fw@strlen.de \
    --cc=hannes@stressinduktion.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).