[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CB94671B.49E3F%roprabhu@cisco.com>
Date: Sun, 25 Mar 2012 06:09:31 -0700
From: Roopa Prabhu <roprabhu@...co.com>
To: John Fastabend <john.r.fastabend@...el.com>, <jhs@...atatu.com>,
<shemminger@...tta.com>, <bhutchings@...arflare.com>,
<davem@...emloft.net>, <jeffrey.t.kirsher@...el.com>
CC: <netdev@...r.kernel.org>, <mst@...hat.com>, <chrisw@...hat.com>,
<gregory.v.rose@...el.com>, <kvm@...r.kernel.org>,
<sri@...ibm.com>, <chealy@...co-us.com>
Subject: Re: [net-next PATCH v0 3/5] net: add fdb generic dump routine
On 3/18/12 11:52 PM, "John Fastabend" <john.r.fastabend@...el.com> 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.
>
> Signed-off-by: John Fastabend <john.r.fastabend@...el.com>
> ---
>
> net/core/rtnetlink.c | 56
> ++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 56 insertions(+), 0 deletions(-)
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 8c3278a..35ee2d6 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -2082,6 +2082,62 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct
> nlmsghdr *nlh, void *arg)
> return err;
> }
>
> +/**
> + * ndo_dflt_fdb_dump: default netdevice operation to dump an FDB table.
> + * @nlh: netlink message header
> + * @dev: netdevice
> + *
> + * Default netdevice operation to dump the existing unicast address list.
> + * Returns zero on success.
> + */
> +int ndo_dflt_fdb_dump(struct sk_buff *skb,
> + struct netlink_callback *cb,
> + struct net_device *dev,
> + int idx)
> +{
> + struct netdev_hw_addr *ha;
> + struct nlmsghdr *nlh;
> + struct ndmsg *ndm;
> + u32 pid, seq;
> +
> + pid = NETLINK_CB(cb->skb).pid;
> + seq = cb->nlh->nlmsg_seq;
> +
> + netif_addr_lock_bh(dev);
> + list_for_each_entry(ha, &dev->uc.list, list) {
> + if (idx < cb->args[0])
> + goto skip;
Any reason why its only uc ?. What about mc ?
> +
> + nlh = nlmsg_put(skb, pid, seq,
> + RTM_NEWNEIGH, sizeof(*ndm), NLM_F_MULTI);
> + if (!nlh)
> + break;
> +
> + ndm = nlmsg_data(nlh);
> + ndm->ndm_family = AF_BRIDGE;
> + ndm->ndm_pad1 = 0;
> + ndm->ndm_pad2 = 0;
> + ndm->ndm_flags = NTF_LOWERDEV;
> + ndm->ndm_type = 0;
> + ndm->ndm_ifindex = dev->ifindex;
> + ndm->ndm_state = NUD_PERMANENT;
> +
> + NLA_PUT(skb, NDA_LLADDR, ETH_ALEN, ha->addr);
> +
> + nlmsg_end(skb, nlh);
> +skip:
> + ++idx;
> + }
> + netif_addr_unlock_bh(dev);
> +
> + return idx;
> +nla_put_failure:
> + netif_addr_unlock_bh(dev);
> + nlmsg_cancel(skb, nlh);
> + return idx;
> +}
> +EXPORT_SYMBOL(ndo_dflt_fdb_dump);
> +
> static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
> {
> int idx = 0;
>
--
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