[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1334115901.7150.371.camel@deadeye>
Date: Wed, 11 Apr 2012 04:45:01 +0100
From: Ben Hutchings <bhutchings@...arflare.com>
To: John Fastabend <john.r.fastabend@...el.com>
CC: <roprabhu@...co.com>, <mst@...hat.com>,
<stephen.hemminger@...tta.com>, <davem@...emloft.net>,
<hadi@...erus.ca>, <jeffrey.t.kirsher@...el.com>,
<netdev@...r.kernel.org>, <gregory.v.rose@...el.com>,
<krkumar2@...ibm.com>, <sri@...ibm.com>
Subject: Re: [net-next PATCH v1 3/7] net: add fdb generic dump routine
On Mon, 2012-04-09 at 15:00 -0700, John Fastabend wrote:
> This adds a generic dump routine drivers can call. It
> should be sufficient to handle any bridging model that
> uses the unicast address list. This should be most SR-IOV
> enabled NICs.
[...]
> +static int nlmsg_populate_fdb(struct sk_buff *skb,
> + struct netlink_callback *cb,
> + struct net_device *dev,
> + int *idx,
> + struct netdev_hw_addr_list *list)
> +{
> + struct netdev_hw_addr *ha;
> + struct ndmsg *ndm;
> + struct nlmsghdr *nlh;
> + u32 pid, seq;
> +
> + pid = NETLINK_CB(cb->skb).pid;
> + seq = cb->nlh->nlmsg_seq;
> +
> + list_for_each_entry(ha, &list->list, list) {
> + if (*idx < cb->args[0])
> + goto skip;
> +
> + nlh = nlmsg_put(skb, pid, seq,
> + RTM_NEWNEIGH, sizeof(*ndm), NLM_F_MULTI);
> + if (!nlh)
> + break;
This break is effectively return 0, but shouldn't we return an error?
In practice this does no harm because any subsequent invocation of
nlmsg_populate_fdb() for the same skb is also going to fail here with no
change to *idx. But it would be more obviously correct to return an
error.
[...]
> + }
> + return 0;
> +nla_put_failure:
> + nlmsg_cancel(skb, nlh);
> + return -ENOMEM;
> +}
[...]
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists