* [PATCH iproute2 1/2] ss: Unify unix stats output from netlink and proc
From: Vadim Kochan @ 2014-12-29 23:56 UTC (permalink / raw)
To: netdev; +Cc: Vadim Kochan
In-Reply-To: <1419897380-21012-1-git-send-email-vadim4j@gmail.com>
From: Vadim Kochan <vadim4j@gmail.com>
Refactored to use one func for output unix stats info
from both /proc and netlink.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
misc/ss.c | 99 ++++++++++++++++++++++++---------------------------------------
1 file changed, 37 insertions(+), 62 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index f0c7b34..88b14f8 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -2234,6 +2234,7 @@ struct unixstat
struct unixstat *next;
int ino;
int peer;
+ char *peer_name;
int rq;
int wq;
int state;
@@ -2279,7 +2280,18 @@ static const char *unix_netid_name(int type)
return netid;
}
-static void unix_list_print(struct unixstat *list, struct filter *f)
+static int unix_type_skip(struct unixstat *s, struct filter *f)
+{
+ if (s->type == SOCK_STREAM && !(f->dbs&(1<<UNIX_ST_DB)))
+ return 1;
+ if (s->type == SOCK_DGRAM && !(f->dbs&(1<<UNIX_DG_DB)))
+ return 1;
+ if (s->type == SOCK_SEQPACKET && !(f->dbs&(1<<UNIX_SQ_DB)))
+ return 1;
+ return 0;
+}
+
+static void unix_stats_print(struct unixstat *list, struct filter *f)
{
struct unixstat *s;
char *peer;
@@ -2287,15 +2299,14 @@ static void unix_list_print(struct unixstat *list, struct filter *f)
for (s = list; s; s = s->next) {
if (!(f->states & (1<<s->state)))
continue;
- if (s->type == SOCK_STREAM && !(f->dbs&(1<<UNIX_ST_DB)))
- continue;
- if (s->type == SOCK_DGRAM && !(f->dbs&(1<<UNIX_DG_DB)))
- continue;
- if (s->type == SOCK_SEQPACKET && !(f->dbs&(1<<UNIX_SQ_DB)))
+ if (unix_type_skip(s, f))
continue;
peer = "*";
- if (s->peer) {
+ if (s->peer_name)
+ peer = s->peer_name;
+
+ if (s->peer && !s->peer_name) {
struct unixstat *p;
for (p = list; p; p = p->next) {
if (s->peer == p->ino)
@@ -2356,36 +2367,24 @@ static int unix_show_sock(const struct sockaddr_nl *addr, struct nlmsghdr *nlh,
struct unix_diag_msg *r = NLMSG_DATA(nlh);
struct rtattr *tb[UNIX_DIAG_MAX+1];
char name[128];
- int peer_ino;
- __u32 rqlen, wqlen;
+ struct unixstat stat = { .name = "*" , .peer_name = "*" };
parse_rtattr(tb, UNIX_DIAG_MAX, (struct rtattr*)(r+1),
nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
- if (r->udiag_type == SOCK_STREAM && !(f->dbs&(1<<UNIX_ST_DB)))
- return 0;
- if (r->udiag_type == SOCK_DGRAM && !(f->dbs&(1<<UNIX_DG_DB)))
- return 0;
- if (r->udiag_type == SOCK_SEQPACKET && !(f->dbs&(1<<UNIX_SQ_DB)))
- return 0;
+ f->f = NULL;
+ stat.type = r->udiag_type;
+ stat.state = r->udiag_state;
+ stat.ino = r->udiag_ino;
- if (netid_width)
- printf("%-*s ", netid_width,
- unix_netid_name(r->udiag_type));
- if (state_width)
- printf("%-*s ", state_width, sstate_name[r->udiag_state]);
+ if (unix_type_skip(&stat, f))
+ return 0;
if (tb[UNIX_DIAG_RQLEN]) {
struct unix_diag_rqlen *rql = RTA_DATA(tb[UNIX_DIAG_RQLEN]);
- rqlen = rql->udiag_rqueue;
- wqlen = rql->udiag_wqueue;
- } else {
- rqlen = 0;
- wqlen = 0;
+ stat.rq = rql->udiag_rqueue;
+ stat.wq = rql->udiag_wqueue;
}
-
- printf("%-6u %-6u ", rqlen, wqlen);
-
if (tb[UNIX_DIAG_NAME]) {
int len = RTA_PAYLOAD(tb[UNIX_DIAG_NAME]);
@@ -2393,41 +2392,17 @@ static int unix_show_sock(const struct sockaddr_nl *addr, struct nlmsghdr *nlh,
name[len] = '\0';
if (name[0] == '\0')
name[0] = '@';
- } else
- sprintf(name, "*");
-
+ stat.name = &name[0];
+ }
if (tb[UNIX_DIAG_PEER])
- peer_ino = rta_getattr_u32(tb[UNIX_DIAG_PEER]);
- else
- peer_ino = 0;
-
- printf("%*s %-*d %*s %-*d",
- addr_width, name,
- serv_width, r->udiag_ino,
- addr_width, "*", /* FIXME */
- serv_width, peer_ino);
-
- char *buf = NULL;
+ stat.peer = rta_getattr_u32(tb[UNIX_DIAG_PEER]);
- if (show_proc_ctx || show_sock_ctx) {
- if (find_entry(r->udiag_ino, &buf,
- (show_proc_ctx & show_sock_ctx) ?
- PROC_SOCK_CTX : PROC_CTX) > 0) {
- printf(" users:(%s)", buf);
- free(buf);
- }
- } else if (show_users) {
- if (find_entry(r->udiag_ino, &buf, USERS) > 0) {
- printf(" users:(%s)", buf);
- free(buf);
- }
- }
+ unix_stats_print(&stat, f);
if (show_mem) {
- printf("\n\t");
+ printf("\t");
print_skmeminfo(tb, UNIX_DIAG_MEMINFO);
}
-
if (show_details) {
if (tb[UNIX_DIAG_SHUTDOWN]) {
unsigned char mask;
@@ -2435,9 +2410,8 @@ static int unix_show_sock(const struct sockaddr_nl *addr, struct nlmsghdr *nlh,
printf(" %c-%c", mask & 1 ? '-' : '<', mask & 2 ? '-' : '>');
}
}
-
- printf("\n");
-
+ if (show_mem || show_details)
+ printf("\n");
return 0;
}
@@ -2505,6 +2479,7 @@ static int unix_show(struct filter *f)
if (!(u = malloc(sizeof(*u))))
break;
u->name = NULL;
+ u->peer_name = NULL;
if (sscanf(buf, "%x: %x %x %x %x %x %d %s",
&u->peer, &u->rq, &u->wq, &flags, &u->type,
@@ -2544,7 +2519,7 @@ static int unix_show(struct filter *f)
strcpy(u->name, name);
}
if (++cnt > MAX_UNIX_REMEMBER) {
- unix_list_print(list, f);
+ unix_stats_print(list, f);
unix_list_free(list);
list = NULL;
cnt = 0;
@@ -2552,7 +2527,7 @@ static int unix_show(struct filter *f)
}
fclose(fp);
if (list) {
- unix_list_print(list, f);
+ unix_stats_print(list, f);
unix_list_free(list);
list = NULL;
cnt = 0;
--
2.1.3
^ permalink raw reply related
* [PATCH iproute2 0/2] Use one func to output stats from Netlink and /proc
From: Vadim Kochan @ 2014-12-29 23:56 UTC (permalink / raw)
To: netdev; +Cc: Vadim Kochan
Refactoring to use one func to output sock stats
from Netlink and /proc for unix and packet socket types.
I did some testing but I might miss some cases, would be good if someone
can test it too.
Vadim Kochan (2):
ss: Unify unix stats output from netlink and proc
ss: Unify packet stats output from netlink and proc
misc/ss.c | 310 ++++++++++++++++++++++++++------------------------------------
1 file changed, 132 insertions(+), 178 deletions(-)
--
2.1.3
^ permalink raw reply
* Re: [PATCH 1/6] bridge: add support to parse multiple vlan info attributes in IFLA_AF_SPEC
From: Scott Feldman @ 2014-12-29 23:47 UTC (permalink / raw)
To: roopa; +Cc: Netdev, shemminger, vyasevic@redhat.com, Wilson Kok
In-Reply-To: <54A1D157.1000002@cumulusnetworks.com>
On Mon, Dec 29, 2014 at 2:10 PM, roopa <roopa@cumulusnetworks.com> wrote:
> On 12/29/14, 1:40 PM, Scott Feldman wrote:
>>
>> On Mon, Dec 29, 2014 at 1:05 PM, <roopa@cumulusnetworks.com> wrote:
>>>
>>> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>>>
>>> This patch changes bridge IFLA_AF_SPEC netlink attribute parser to
>>> look for more than one IFLA_BRIDGE_VLAN_INFO attribute. This allows
>>> userspace to pack more than one vlan in the setlink msg.
>>>
>>> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
>>> ---
>>> net/bridge/br_netlink.c | 18 +++++++++---------
>>> 1 file changed, 9 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
>>> index 9f5eb55..75971b1 100644
>>> --- a/net/bridge/br_netlink.c
>>> +++ b/net/bridge/br_netlink.c
>>> @@ -230,18 +230,18 @@ static int br_afspec(struct net_bridge *br,
>>> struct nlattr *af_spec,
>>> int cmd)
>>> {
>>> - struct nlattr *tb[IFLA_BRIDGE_MAX+1];
>>> + struct bridge_vlan_info *vinfo;
>>> int err = 0;
>>> + struct nlattr *attr;
>>> + int err = 0;
>>> + int rem;
>>> + u16 vid;
>>>
>>> - err = nla_parse_nested(tb, IFLA_BRIDGE_MAX, af_spec,
>>> ifla_br_policy);
>>
>> Removing this call orphans ifla_br_policy...should ifla_br_policy be
>> removed?
>
>
> good question. Its a good place to see the type. In-fact userspace programs
> also copy the same policy to parse netlink attributes. hmmm..
> I would like to keep it if it does not throw a warning.
I don't know what the policy (sorry, no pun intended) on leaving dead
code. I say remove it.
^ permalink raw reply
* Re: [PATCH 6/6] bridge: add vlan info to bridge setlink and dellink notification messages
From: Scott Feldman @ 2014-12-29 23:42 UTC (permalink / raw)
To: Roopa Prabhu; +Cc: Netdev, shemminger, vyasevic@redhat.com
In-Reply-To: <1419887132-7084-7-git-send-email-roopa@cumulusnetworks.com>
On Mon, Dec 29, 2014 at 1:05 PM, <roopa@cumulusnetworks.com> wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> vlan add/deletes are not notified to userspace today. This patch fixes it.
> Notifications will contain vlans compressed into ranges whereever applicable.
Why is this notification needed? On VLAN add/del, the port driver
will already get called if it implements ndo_vlan_rx_add_vid and
ndo_vlan_rx_kill_vid. The port driver already gets the notification
it needs to filter vlans. User space can query for vlan port
membership if it needs to know.
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> ---
> net/bridge/br_netlink.c | 3 ++-
> net/core/rtnetlink.c | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> index 16bdd5a..cebfb03 100644
> --- a/net/bridge/br_netlink.c
> +++ b/net/bridge/br_netlink.c
> @@ -303,7 +303,8 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port)
> if (skb == NULL)
> goto errout;
>
> - err = br_fill_ifinfo(skb, port, 0, 0, event, 0, 0, port->dev);
> + err = br_fill_ifinfo(skb, port, 0, 0, event, 0,
> + RTEXT_FILTER_BRVLAN_COMPRESSED, port->dev);
This doesn't look right. The skb wasn't allocated large enough to
hold vlan info. If this is working in your tests, you're getting
lucky due to some skb padding.
skb was allocated with br_nlmsg_size(), which doesn't include vlan info.
> if (err < 0) {
> /* -EMSGSIZE implies BUG in br_nlmsg_size() */
> WARN_ON(err == -EMSGSIZE);
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index d06107d..dad5fb6 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -2878,7 +2878,8 @@ static int rtnl_bridge_notify(struct net_device *dev, u16 flags)
>
> if ((!flags || (flags & BRIDGE_FLAGS_MASTER)) &&
> br_dev && br_dev->netdev_ops->ndo_bridge_getlink) {
> - err = br_dev->netdev_ops->ndo_bridge_getlink(skb, 0, 0, dev, 0);
> + err = br_dev->netdev_ops->ndo_bridge_getlink(skb, 0, 0, dev,
> + RTEXT_FILTER_BRVLAN_COMPRESSED);
> if (err < 0)
> goto errout;
> }
> --
> 1.7.10.4
>
> --
> 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
^ permalink raw reply
* Re: [PATCH 5/6] bridge: new function to pack vlans using both IFLA_BRIDGE_VLAN_INFO and IFLA_BRIDGE_VLAN_RANGE_INFO
From: Scott Feldman @ 2014-12-29 23:25 UTC (permalink / raw)
To: Roopa Prabhu; +Cc: Netdev, shemminger, vyasevic@redhat.com, Wilson kok
In-Reply-To: <1419887132-7084-6-git-send-email-roopa@cumulusnetworks.com>
On Mon, Dec 29, 2014 at 1:05 PM, <roopa@cumulusnetworks.com> wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> This patch adds new function to compress vlans into ranges.
> Vlans are compressed into ranges only if the fill request is called with
> RTEXT_FILTER_BRVLAN_COMPRESSED in filtermask.
>
> Old vlan packing code is moved to a new function and continues to be
> called when filter_mask is RTEXT_FILTER_BRVLAN
>
> Signed-off-by: Wilson kok <wkok@cumulusnetworks.com>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> ---
> net/bridge/br_netlink.c | 157 +++++++++++++++++++++++++++++++++++++++++------
> 1 file changed, 137 insertions(+), 20 deletions(-)
>
> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> index 4c47ba0..16bdd5a 100644
> --- a/net/bridge/br_netlink.c
> +++ b/net/bridge/br_netlink.c
> @@ -67,6 +67,133 @@ static int br_port_fill_attrs(struct sk_buff *skb,
> return 0;
> }
>
> +static int br_fill_ifvlaninfo_bitmap(struct sk_buff *skb,
> + const unsigned long *vlan_bmp, u16 flags)
> +{
> + struct bridge_vlan_range_info vinfo_range;
> + struct bridge_vlan_info vinfo;
> + u16 vid, start = 0, end = 0;
One per line?
> + u16 pvid;
Aren't you getting an "unused" compile warning on this ^^^?
> +
> + /* handle the untagged */
This comment ^^^ doesn't make sense here.
> + for_each_set_bit(vid, vlan_bmp, VLAN_N_VID) {
> + if (start == 0) {
> + start = vid;
> + end = vid;
> + }
> + if ((vid - end) > 1) {
> + memset(&vinfo_range, 0, sizeof(vinfo_range));
> + vinfo_range.flags |= flags;
> + vinfo_range.vid = start;
> + vinfo_range.vid_end = end;
> + if (nla_put(skb, IFLA_BRIDGE_VLAN_RANGE_INFO,
> + sizeof(vinfo_range), &vinfo_range))
> + goto nla_put_failure;
> + start = vid;
> + end = vid;
> + } else {
> + end = vid;
> + }
> + }
What happens with this set {1-10, 12, 20-25, 30}? On vid 12, will
that put a VLAN_RANGE_INFO with start=end=12? Seems strange to use
RANGE_INFO for single vlan.
Can the algorithm be simplified? Maybe there are other examples in
the kernel of finding ranges/singles from a bitmap we could borrow
code from?
> + if (start != 0 && end != 0) {
> + if (start != end) {
> + memset(&vinfo_range, 0, sizeof(vinfo_range));
> + vinfo_range.flags |= flags;
> + vinfo_range.vid = start;
> + vinfo_range.vid_end = end;
> + if (nla_put(skb, IFLA_BRIDGE_VLAN_RANGE_INFO,
> + sizeof(vinfo_range), &vinfo_range))
> + goto nla_put_failure;
> + } else {
> + memset(&vinfo, 0, sizeof(vinfo));
> + vinfo.flags |= flags;
> + vinfo.vid = start;
> + if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
> + sizeof(vinfo), &vinfo))
> + goto nla_put_failure;
How many IFLA_BRIDGE_VLAN_INFOs can you fit into skb? It seems the
worst case is you'll have 4094/2 = 2047 VLAN_INFOs if using all
even-numbered vids, for example. Will that fit? I guess the original
code had the same concern...wonder if anyone checked this worst-case?
> + }
> + }
> +
> +nla_put_failure:
> + return -EMSGSIZE;
> +}
> +
> +static int br_fill_ifvlaninfo_compressed(struct sk_buff *skb,
> + const struct net_port_vlans *pv)
> +{
> + unsigned long vlan_bmp_copy[BR_VLAN_BITMAP_LEN];
> + unsigned long untagged_bmp_copy[BR_VLAN_BITMAP_LEN];
Lots of automatic space on the stack...can you use dynamic mem
(kzalloc) for these?
> + struct bridge_vlan_range_info vinfo_range;
> + struct bridge_vlan_info vinfo;
> + u16 pvid;
> +
> + memset(vlan_bmp_copy, 0,
> + sizeof(unsigned long) * BR_VLAN_BITMAP_LEN);
> + bitmap_copy(vlan_bmp_copy, pv->vlan_bitmap, VLAN_N_VID);
> +
> + memset(untagged_bmp_copy, 0,
> + sizeof(unsigned long) * BR_VLAN_BITMAP_LEN);
> + bitmap_copy(untagged_bmp_copy, pv->untagged_bitmap, VLAN_N_VID);
> +
> + /* send the pvid separately first */
> + pvid = br_get_pvid(pv);
> + if (pvid && (pvid != VLAN_N_VID)) {
> + memset(&vinfo, 0, sizeof(vinfo));
> + vinfo.flags |= BRIDGE_VLAN_INFO_PVID;
> + if (test_bit(pvid, untagged_bmp_copy)) {
> + vinfo.flags |= BRIDGE_VLAN_INFO_UNTAGGED;
> + clear_bit(pvid, untagged_bmp_copy);
> + }
> + clear_bit(pvid, vlan_bmp_copy);
> + vinfo.vid = pvid;
> + if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
> + sizeof(vinfo), &vinfo))
> + goto nla_put_failure;
> + }
What if pvid is not in vlan_bmp_copy? This statement block seems
slightly different than the original logic where BRIDGE_VLAN_INFO_PVID
was set only when looping thru vlan_bitmap and vid == pvid. Now can
you send a IFLA_BRIDGE_VLAN_INFO with pvid even if pvid isn't in
vlan_bitmap? Maybe pvid is always in vlan_bitmap, so it doesn't
matter. But there is a subtle logic change here, so something to
consider.
> +
> + /* fill untagged vlans */
> + br_fill_ifvlaninfo_bitmap(skb, untagged_bmp_copy,
> + BRIDGE_VLAN_INFO_UNTAGGED);
This might be doing more than original logic. Original logic looped
thru vid in vlan_btimap and checked if vid was in untagged_bitmap.
Here you're dumping all bits in untagged_bitmap, without looking if
bit was set in vlan_bitmap. Maybe you want to do an intersection of
sets vlan_bitmap and untagged_bitmap.
> + for_each_set_bit(vid, untagged_bmp_copy, VLAN_N_VID)
> + clear_bit(vid, vlan_bmp_copy);
> +
> + /* fill tagged vlans */
> + br_fill_ifvlaninfo_bitmap(skb, vlan_bmp_copy, 0);
> +
> + return 0;
> +
> +nla_put_failure:
> + return -EMSGSIZE;
> +}
> +
> +static int br_fill_ifvlaninfo(struct sk_buff *skb,
> + const struct net_port_vlans *pv)
> +{
> + struct bridge_vlan_info vinfo;
> + u16 pvid, vid;
> +
> + pvid = br_get_pvid(pv);
> + for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
> + vinfo.vid = vid;
> + vinfo.flags = 0;
> + if (vid == pvid)
> + vinfo.flags |= BRIDGE_VLAN_INFO_PVID;
> +
> + if (test_bit(vid, pv->untagged_bitmap))
> + vinfo.flags |= BRIDGE_VLAN_INFO_UNTAGGED;
> +
> + if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
> + sizeof(vinfo), &vinfo))
> + goto nla_put_failure;
> + }
> +
> + return 0;
> +
> +nla_put_failure:
> + return -EMSGSIZE;
> +}
> +
> /*
> * Create one netlink message for one interface
> * Contains port and master info as well as carrier and bridge state.
> @@ -121,12 +248,11 @@ static int br_fill_ifinfo(struct sk_buff *skb,
> }
>
> /* Check if the VID information is requested */
> - if (filter_mask & RTEXT_FILTER_BRVLAN) {
> - struct nlattr *af;
> + if ((filter_mask & RTEXT_FILTER_BRVLAN) ||
> + (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)) {
> const struct net_port_vlans *pv;
> - struct bridge_vlan_info vinfo;
> - u16 vid;
> - u16 pvid;
> + struct nlattr *af;
> + int err;
>
> if (port)
> pv = nbp_get_vlan_info(port);
> @@ -140,21 +266,12 @@ static int br_fill_ifinfo(struct sk_buff *skb,
> if (!af)
> goto nla_put_failure;
>
> - pvid = br_get_pvid(pv);
> - for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
> - vinfo.vid = vid;
> - vinfo.flags = 0;
> - if (vid == pvid)
> - vinfo.flags |= BRIDGE_VLAN_INFO_PVID;
> -
> - if (test_bit(vid, pv->untagged_bitmap))
> - vinfo.flags |= BRIDGE_VLAN_INFO_UNTAGGED;
> -
> - if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
> - sizeof(vinfo), &vinfo))
> - goto nla_put_failure;
> - }
> -
> + if (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)
> + err = br_fill_ifvlaninfo_compressed(skb, pv);
> + else
> + err = br_fill_ifvlaninfo(skb, pv);
> + if (err)
> + goto nla_put_failure;
> nla_nest_end(skb, af);
> }
>
> --
> 1.7.10.4
>
> --
> 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
^ permalink raw reply
* Re: Marvell Kirkwood - MV643XX: near 100% UDP RX packet loss
From: Rick Jones @ 2014-12-29 23:25 UTC (permalink / raw)
To: Bruno Prémont; +Cc: Sebastian Hesselbarth, netdev
In-Reply-To: <20141227121727.20fe52c8@neptune.home>
On 12/27/2014 03:17 AM, Bruno Prémont wrote:
> On Thu, 25 December 2014 Rick Jones <rick.jones2@hp.com> wrote:
>>> Why are so many packets being discarded?
>>
>> You should also check the netstat statistics, particularly UDP on the
>> receiving side. Look before and after the test and see how they change,
>> if at all.
>
> Here they go.
>
> Summary of numbers:
> iperf UDP run, 5 seconds @ 1Gb/s
> lost 71216/71776 packets
>
> before after delta
> ethtool:
> rx_packets: 420001 688424 268423
> rx_bytes: 433251917 809803463 376551546
> rx_errors: 0 0 0
> rx_dropped: 0 0 0
> bad_octets_received: 0 0 0
> bad_frames_received: 0 0 0
> rx_discard: 159691 323123 163432
> rx_overrun: 0 0 0
> netstat, udp:
> packets received 15559 16137 578
> packets to unknown port received 18 18 0
> packet receive errors 41599 83890 42291
> packets sent 34697 34770 73
> receive buffer errors 0 0 0
> send buffer errors 0 0 0
>
Well, it certainly looks like a decent fraction of your lost traffic are
UDP packet receive errors. Overrunning the SO_RCVBUF on the receiving
side presumably. You can either start walking-down the transmission
rate of the iperf client, or try a larger receive socket buffer size on
the iperf server, though that will only help if those drops are from the
receiving side being only occasionally slower than the sending side.
You might also want to make sure the UDP datagrams being sent are huge
and so getting fragmented. All it takes is to lose one fragment of an
IP datagram to render the entire datagram useless.
As for the rx_discard in the ethtool stats, someone more familiar with
the hardware will have to describe the various reasons for that stat to
be incremented.
rick jones
^ permalink raw reply
* Re: [PATCH 3/6] bridge: modify IFLA_AF_SPEC parser to parse IFLA_BRIDGE_VLAN_RANGE_INFO
From: roopa @ 2014-12-29 23:19 UTC (permalink / raw)
To: Scott Feldman; +Cc: Netdev, shemminger, vyasevic@redhat.com, Wilson kok
In-Reply-To: <CAE4R7bA5ZhwX=agK-BOPWoJ1sctQuVcJ92z78Rrtp-=pBWi4jg@mail.gmail.com>
On 12/29/14, 2:04 PM, Scott Feldman wrote:
> On Mon, Dec 29, 2014 at 1:05 PM, <roopa@cumulusnetworks.com> wrote:
>> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>>
>> This patch modifies br_afspec to parse incoming IFLA_BRIDGE_VLAN_RANGE_INFO
>>
>> Signed-off-by: Wilson kok <wkok@cumulusnetworks.com>
>> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
>> ---
>> net/bridge/br_netlink.c | 70 +++++++++++++++++++++++++++++++++--------------
>> 1 file changed, 49 insertions(+), 21 deletions(-)
>>
>> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
>> index e7d1fc0..4c47ba0 100644
>> --- a/net/bridge/br_netlink.c
>> +++ b/net/bridge/br_netlink.c
>> @@ -227,48 +227,76 @@ static const struct nla_policy ifla_br_policy[IFLA_MAX+1] = {
>> .len = sizeof(struct bridge_vlan_range_info), },
>> };
>>
>> +static int br_afspec_vlan_add(struct net_bridge *br,
>> + struct net_bridge_port *p,
>> + u16 vid, u16 flags)
>> +{
>> + int err = 0;
>> +
>> + if (p) {
>> + err = nbp_vlan_add(p, vid, flags);
>> + if (err)
>> + return err;
>> +
>> + if (flags & BRIDGE_VLAN_INFO_MASTER)
>> + err = br_vlan_add(p->br, vid, flags);
>> + } else {
>> + err = br_vlan_add(br, vid, flags);
>> + }
>> +
>> + return err;
>> +}
>> +
>> +static void br_afspec_vlan_del(struct net_bridge *br,
>> + struct net_bridge_port *p,
>> + u16 vid, u16 flags)
>> +{
>> + if (p) {
>> + nbp_vlan_delete(p, vid);
>> + if (flags & BRIDGE_VLAN_INFO_MASTER)
>> + br_vlan_delete(p->br, vid);
>> + } else {
>> + br_vlan_delete(br, vid);
>> + }
>> +}
>> +
>> static int br_afspec(struct net_bridge *br,
>> struct net_bridge_port *p,
>> struct nlattr *af_spec,
>> int cmd)
>> {
>> - struct bridge_vlan_info *vinfo;
>> - int err = 0;
>> + struct bridge_vlan_range_info *vinfo;
>> struct nlattr *attr;
>> int err = 0;
>> int rem;
>> u16 vid;
>>
>> nla_for_each_nested(attr, af_spec, rem) {
>> - if (nla_type(attr) != IFLA_BRIDGE_VLAN_INFO)
>> + if (nla_type(attr) != IFLA_BRIDGE_VLAN_INFO &&
>> + nla_type(attr) != IFLA_BRIDGE_VLAN_RANGE_INFO)
>> continue;
>> -
>> vinfo = nla_data(attr);
> Check attr size.
>
>> - if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK)
>> +
>> + if (nla_type(attr) == IFLA_BRIDGE_VLAN_INFO)
>> + vinfo->vid_end = vinfo->vid;
> Maybe a switch(nla_type(attr)) would be better to explicitly handle
> each case? Then the size check can be done for each case, as well as
> this fix-up for vid_end.
sure, i can do that.
>
>> +
>> + if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK ||
>> + vinfo->vid_end >= VLAN_VID_MASK ||
>> + vinfo->vid > vinfo->vid_end)
>> return -EINVAL;
>>
>> switch (cmd) {
>> case RTM_SETLINK:
>> - if (p) {
>> - err = nbp_vlan_add(p, vinfo->vid, vinfo->flags);
>> + for (vid = vinfo->vid; vid <= vinfo->vid_end; vid++) {
>> + err = br_afspec_vlan_add(br, p, vid,
>> + vinfo->flags);
>> if (err)
> Do you want to unwind on failure? Seems it should be an
> all-or-nothing operation.
I could, but looking at other link operations, I don't seen anybody
unwinding. An AF_UNSPEC link netlink request can contain multiple link
attributes and not all maybe applied AFAICS. But i don't have a strong
opinion here. I can unwind if needed.
>> break;
>> -
>> - if (vinfo->flags & BRIDGE_VLAN_INFO_MASTER)
>> - err = br_vlan_add(p->br, vinfo->vid,
>> - vinfo->flags);
>> - } else
>> - err = br_vlan_add(br, vinfo->vid, vinfo->flags);
>> -
>> + }
>> break;
>> -
>> case RTM_DELLINK:
>> - if (p) {
>> - nbp_vlan_delete(p, vinfo->vid);
>> - if (vinfo->flags & BRIDGE_VLAN_INFO_MASTER)
>> - br_vlan_delete(p->br, vinfo->vid);
>> - } else
>> - br_vlan_delete(br, vinfo->vid);
>> + for (vid = vinfo->vid; vid <= vinfo->vid_end; vid++)
>> + br_afspec_vlan_del(br, p, vid, vinfo->flags);
>> break;
>> }
>> }
>> --
>> 1.7.10.4
>>
>> --
>> 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
^ permalink raw reply
* Re: [PATCH/RFC flow-net-next 02/10] net: flow: Add features to tables
From: Cong Wang @ 2014-12-29 23:03 UTC (permalink / raw)
To: Simon Horman; +Cc: John Fastabend, netdev
In-Reply-To: <1419819340-19000-3-git-send-email-simon.horman@netronome.com>
On Sun, Dec 28, 2014 at 6:15 PM, Simon Horman
<simon.horman@netronome.com> wrote:
> +static struct net_flow_table *net_flow_table_get_table(struct net_device *dev,
> + int table_uid)
> +{
> + struct net_flow_table **tables;
> + int i;
> +
> + tables = net_flow_get_tables(dev);
> + if (IS_ERR(tables))
> + return ERR_PTR(PTR_ERR(tables));
Seriously? :)
^ permalink raw reply
* Re: [PATCH 2/6] bridge: add new attribute IFLA_BRIDGE_VLAN_RANGE_INFO to represent vlan range
From: roopa @ 2014-12-29 22:10 UTC (permalink / raw)
To: Scott Feldman; +Cc: Netdev, shemminger, vyasevic@redhat.com, Wilson Kok
In-Reply-To: <CAE4R7bCYJam86BYf9N8Z63g58njHrjpaH3sdHoSqJBxyFq=Y4g@mail.gmail.com>
On 12/29/14, 1:52 PM, Scott Feldman wrote:
> On Mon, Dec 29, 2014 at 1:05 PM, <roopa@cumulusnetworks.com> wrote:
>> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>>
>> This patch adds new bridge netlink attribute IFLA_BRIDGE_VLAN_RANGE_INFO
>> to represent vlan range.
>>
>> Current IFLA_BRIDGE_VLAN_INFO attribute represents a single vlan and
>> does not scale well when the port has large number of vlans.
>>
>> IFLA_BRIDGE_VLAN_RANGE_INFO is similar to IFLA_BRIDGE_VLAN_INFO but helps
>> with packing consecutive vlans in a single attribute. Thus reducing the
>> size of the netlink msg during adds and also during dumps.
>>
>> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
>> Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
>> ---
>> include/uapi/linux/if_bridge.h | 7 +++++++
>> net/bridge/br_netlink.c | 2 ++
>> 2 files changed, 9 insertions(+)
>>
>> diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
>> index b03ee8f..d41a346 100644
>> --- a/include/uapi/linux/if_bridge.h
>> +++ b/include/uapi/linux/if_bridge.h
>> @@ -118,6 +118,7 @@ enum {
>> IFLA_BRIDGE_FLAGS,
>> IFLA_BRIDGE_MODE,
>> IFLA_BRIDGE_VLAN_INFO,
>> + IFLA_BRIDGE_VLAN_RANGE_INFO,
>> __IFLA_BRIDGE_MAX,
>> };
>> #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
>> @@ -131,6 +132,12 @@ struct bridge_vlan_info {
>> __u16 vid;
>> };
>>
>> +struct bridge_vlan_range_info {
>> + __u16 flags;
>> + __u16 vid;
> vid_start or vid_begin to be consistent with vid_end?
ack..
>
>> + __u16 vid_end;
>> +};
>> +
>> /* Bridge multicast database attributes
>> * [MDBA_MDB] = {
>> * [MDBA_MDB_ENTRY] = {
>> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
>> index 75971b1..e7d1fc0 100644
>> --- a/net/bridge/br_netlink.c
>> +++ b/net/bridge/br_netlink.c
>> @@ -223,6 +223,8 @@ static const struct nla_policy ifla_br_policy[IFLA_MAX+1] = {
>> [IFLA_BRIDGE_MODE] = { .type = NLA_U16 },
>> [IFLA_BRIDGE_VLAN_INFO] = { .type = NLA_BINARY,
>> .len = sizeof(struct bridge_vlan_info), },
>> + [IFLA_BRIDGE_VLAN_RANGE_INFO] = { .type = NLA_BINARY,
>> + .len = sizeof(struct bridge_vlan_range_info), },
> ifla_br_policy isn't used anymore from patch 1/6, so no need to add this.
>
>> };
>>
>> static int br_afspec(struct net_bridge *br,
>> --
>> 1.7.10.4
>>
>> --
>> 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
^ permalink raw reply
* Re: [PATCH 1/6] bridge: add support to parse multiple vlan info attributes in IFLA_AF_SPEC
From: roopa @ 2014-12-29 22:10 UTC (permalink / raw)
To: Scott Feldman; +Cc: Netdev, shemminger, vyasevic@redhat.com, Wilson Kok
In-Reply-To: <CAE4R7bAyWy83S-K_XtiRNJO2rZXtVpijPxqj_oq_sZqPKW-h-Q@mail.gmail.com>
On 12/29/14, 1:40 PM, Scott Feldman wrote:
> On Mon, Dec 29, 2014 at 1:05 PM, <roopa@cumulusnetworks.com> wrote:
>> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>>
>> This patch changes bridge IFLA_AF_SPEC netlink attribute parser to
>> look for more than one IFLA_BRIDGE_VLAN_INFO attribute. This allows
>> userspace to pack more than one vlan in the setlink msg.
>>
>> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
>> ---
>> net/bridge/br_netlink.c | 18 +++++++++---------
>> 1 file changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
>> index 9f5eb55..75971b1 100644
>> --- a/net/bridge/br_netlink.c
>> +++ b/net/bridge/br_netlink.c
>> @@ -230,18 +230,18 @@ static int br_afspec(struct net_bridge *br,
>> struct nlattr *af_spec,
>> int cmd)
>> {
>> - struct nlattr *tb[IFLA_BRIDGE_MAX+1];
>> + struct bridge_vlan_info *vinfo;
>> int err = 0;
>> + struct nlattr *attr;
>> + int err = 0;
>> + int rem;
>> + u16 vid;
>>
>> - err = nla_parse_nested(tb, IFLA_BRIDGE_MAX, af_spec, ifla_br_policy);
> Removing this call orphans ifla_br_policy...should ifla_br_policy be removed?
good question. Its a good place to see the type. In-fact userspace
programs also copy the same policy to parse netlink attributes. hmmm..
I would like to keep it if it does not throw a warning.
>
>> - if (err)
>> - return err;
>> -
>> - if (tb[IFLA_BRIDGE_VLAN_INFO]) {
>> - struct bridge_vlan_info *vinfo;
>> -
>> - vinfo = nla_data(tb[IFLA_BRIDGE_VLAN_INFO]);
>> + nla_for_each_nested(attr, af_spec, rem) {
>> + if (nla_type(attr) != IFLA_BRIDGE_VLAN_INFO)
>> + continue;
> Need to validate size of attr is sizeof(struct bridge_vlan_info).
ack, will fix.
>
>> + vinfo = nla_data(attr);
>> if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK)
>> return -EINVAL;
>>
>> --
>> 1.7.10.4
>>
>> --
>> 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
^ permalink raw reply
* Re: [PATCH 3/6] bridge: modify IFLA_AF_SPEC parser to parse IFLA_BRIDGE_VLAN_RANGE_INFO
From: Scott Feldman @ 2014-12-29 22:04 UTC (permalink / raw)
To: Roopa Prabhu; +Cc: Netdev, shemminger, vyasevic@redhat.com, Wilson kok
In-Reply-To: <1419887132-7084-4-git-send-email-roopa@cumulusnetworks.com>
On Mon, Dec 29, 2014 at 1:05 PM, <roopa@cumulusnetworks.com> wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> This patch modifies br_afspec to parse incoming IFLA_BRIDGE_VLAN_RANGE_INFO
>
> Signed-off-by: Wilson kok <wkok@cumulusnetworks.com>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> ---
> net/bridge/br_netlink.c | 70 +++++++++++++++++++++++++++++++++--------------
> 1 file changed, 49 insertions(+), 21 deletions(-)
>
> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> index e7d1fc0..4c47ba0 100644
> --- a/net/bridge/br_netlink.c
> +++ b/net/bridge/br_netlink.c
> @@ -227,48 +227,76 @@ static const struct nla_policy ifla_br_policy[IFLA_MAX+1] = {
> .len = sizeof(struct bridge_vlan_range_info), },
> };
>
> +static int br_afspec_vlan_add(struct net_bridge *br,
> + struct net_bridge_port *p,
> + u16 vid, u16 flags)
> +{
> + int err = 0;
> +
> + if (p) {
> + err = nbp_vlan_add(p, vid, flags);
> + if (err)
> + return err;
> +
> + if (flags & BRIDGE_VLAN_INFO_MASTER)
> + err = br_vlan_add(p->br, vid, flags);
> + } else {
> + err = br_vlan_add(br, vid, flags);
> + }
> +
> + return err;
> +}
> +
> +static void br_afspec_vlan_del(struct net_bridge *br,
> + struct net_bridge_port *p,
> + u16 vid, u16 flags)
> +{
> + if (p) {
> + nbp_vlan_delete(p, vid);
> + if (flags & BRIDGE_VLAN_INFO_MASTER)
> + br_vlan_delete(p->br, vid);
> + } else {
> + br_vlan_delete(br, vid);
> + }
> +}
> +
> static int br_afspec(struct net_bridge *br,
> struct net_bridge_port *p,
> struct nlattr *af_spec,
> int cmd)
> {
> - struct bridge_vlan_info *vinfo;
> - int err = 0;
> + struct bridge_vlan_range_info *vinfo;
> struct nlattr *attr;
> int err = 0;
> int rem;
> u16 vid;
>
> nla_for_each_nested(attr, af_spec, rem) {
> - if (nla_type(attr) != IFLA_BRIDGE_VLAN_INFO)
> + if (nla_type(attr) != IFLA_BRIDGE_VLAN_INFO &&
> + nla_type(attr) != IFLA_BRIDGE_VLAN_RANGE_INFO)
> continue;
> -
> vinfo = nla_data(attr);
Check attr size.
> - if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK)
> +
> + if (nla_type(attr) == IFLA_BRIDGE_VLAN_INFO)
> + vinfo->vid_end = vinfo->vid;
Maybe a switch(nla_type(attr)) would be better to explicitly handle
each case? Then the size check can be done for each case, as well as
this fix-up for vid_end.
> +
> + if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK ||
> + vinfo->vid_end >= VLAN_VID_MASK ||
> + vinfo->vid > vinfo->vid_end)
> return -EINVAL;
>
> switch (cmd) {
> case RTM_SETLINK:
> - if (p) {
> - err = nbp_vlan_add(p, vinfo->vid, vinfo->flags);
> + for (vid = vinfo->vid; vid <= vinfo->vid_end; vid++) {
> + err = br_afspec_vlan_add(br, p, vid,
> + vinfo->flags);
> if (err)
Do you want to unwind on failure? Seems it should be an
all-or-nothing operation.
> break;
> -
> - if (vinfo->flags & BRIDGE_VLAN_INFO_MASTER)
> - err = br_vlan_add(p->br, vinfo->vid,
> - vinfo->flags);
> - } else
> - err = br_vlan_add(br, vinfo->vid, vinfo->flags);
> -
> + }
> break;
> -
> case RTM_DELLINK:
> - if (p) {
> - nbp_vlan_delete(p, vinfo->vid);
> - if (vinfo->flags & BRIDGE_VLAN_INFO_MASTER)
> - br_vlan_delete(p->br, vinfo->vid);
> - } else
> - br_vlan_delete(br, vinfo->vid);
> + for (vid = vinfo->vid; vid <= vinfo->vid_end; vid++)
> + br_afspec_vlan_del(br, p, vid, vinfo->flags);
> break;
> }
> }
> --
> 1.7.10.4
>
> --
> 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
^ permalink raw reply
* Re: [PATCH 2/6] bridge: add new attribute IFLA_BRIDGE_VLAN_RANGE_INFO to represent vlan range
From: Scott Feldman @ 2014-12-29 21:52 UTC (permalink / raw)
To: Roopa Prabhu; +Cc: Netdev, shemminger, vyasevic@redhat.com, Wilson Kok
In-Reply-To: <1419887132-7084-3-git-send-email-roopa@cumulusnetworks.com>
On Mon, Dec 29, 2014 at 1:05 PM, <roopa@cumulusnetworks.com> wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> This patch adds new bridge netlink attribute IFLA_BRIDGE_VLAN_RANGE_INFO
> to represent vlan range.
>
> Current IFLA_BRIDGE_VLAN_INFO attribute represents a single vlan and
> does not scale well when the port has large number of vlans.
>
> IFLA_BRIDGE_VLAN_RANGE_INFO is similar to IFLA_BRIDGE_VLAN_INFO but helps
> with packing consecutive vlans in a single attribute. Thus reducing the
> size of the netlink msg during adds and also during dumps.
>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
> ---
> include/uapi/linux/if_bridge.h | 7 +++++++
> net/bridge/br_netlink.c | 2 ++
> 2 files changed, 9 insertions(+)
>
> diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
> index b03ee8f..d41a346 100644
> --- a/include/uapi/linux/if_bridge.h
> +++ b/include/uapi/linux/if_bridge.h
> @@ -118,6 +118,7 @@ enum {
> IFLA_BRIDGE_FLAGS,
> IFLA_BRIDGE_MODE,
> IFLA_BRIDGE_VLAN_INFO,
> + IFLA_BRIDGE_VLAN_RANGE_INFO,
> __IFLA_BRIDGE_MAX,
> };
> #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
> @@ -131,6 +132,12 @@ struct bridge_vlan_info {
> __u16 vid;
> };
>
> +struct bridge_vlan_range_info {
> + __u16 flags;
> + __u16 vid;
vid_start or vid_begin to be consistent with vid_end?
> + __u16 vid_end;
> +};
> +
> /* Bridge multicast database attributes
> * [MDBA_MDB] = {
> * [MDBA_MDB_ENTRY] = {
> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> index 75971b1..e7d1fc0 100644
> --- a/net/bridge/br_netlink.c
> +++ b/net/bridge/br_netlink.c
> @@ -223,6 +223,8 @@ static const struct nla_policy ifla_br_policy[IFLA_MAX+1] = {
> [IFLA_BRIDGE_MODE] = { .type = NLA_U16 },
> [IFLA_BRIDGE_VLAN_INFO] = { .type = NLA_BINARY,
> .len = sizeof(struct bridge_vlan_info), },
> + [IFLA_BRIDGE_VLAN_RANGE_INFO] = { .type = NLA_BINARY,
> + .len = sizeof(struct bridge_vlan_range_info), },
ifla_br_policy isn't used anymore from patch 1/6, so no need to add this.
> };
>
> static int br_afspec(struct net_bridge *br,
> --
> 1.7.10.4
>
> --
> 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
^ permalink raw reply
* Re: [PATCH 1/6] bridge: add support to parse multiple vlan info attributes in IFLA_AF_SPEC
From: Scott Feldman @ 2014-12-29 21:40 UTC (permalink / raw)
To: Roopa Prabhu; +Cc: Netdev, shemminger, vyasevic@redhat.com
In-Reply-To: <1419887132-7084-2-git-send-email-roopa@cumulusnetworks.com>
On Mon, Dec 29, 2014 at 1:05 PM, <roopa@cumulusnetworks.com> wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> This patch changes bridge IFLA_AF_SPEC netlink attribute parser to
> look for more than one IFLA_BRIDGE_VLAN_INFO attribute. This allows
> userspace to pack more than one vlan in the setlink msg.
>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> ---
> net/bridge/br_netlink.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> index 9f5eb55..75971b1 100644
> --- a/net/bridge/br_netlink.c
> +++ b/net/bridge/br_netlink.c
> @@ -230,18 +230,18 @@ static int br_afspec(struct net_bridge *br,
> struct nlattr *af_spec,
> int cmd)
> {
> - struct nlattr *tb[IFLA_BRIDGE_MAX+1];
> + struct bridge_vlan_info *vinfo;
> int err = 0;
> + struct nlattr *attr;
> + int err = 0;
> + int rem;
> + u16 vid;
>
> - err = nla_parse_nested(tb, IFLA_BRIDGE_MAX, af_spec, ifla_br_policy);
Removing this call orphans ifla_br_policy...should ifla_br_policy be removed?
> - if (err)
> - return err;
> -
> - if (tb[IFLA_BRIDGE_VLAN_INFO]) {
> - struct bridge_vlan_info *vinfo;
> -
> - vinfo = nla_data(tb[IFLA_BRIDGE_VLAN_INFO]);
> + nla_for_each_nested(attr, af_spec, rem) {
> + if (nla_type(attr) != IFLA_BRIDGE_VLAN_INFO)
> + continue;
Need to validate size of attr is sizeof(struct bridge_vlan_info).
>
> + vinfo = nla_data(attr);
> if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK)
> return -EINVAL;
>
> --
> 1.7.10.4
>
> --
> 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
^ permalink raw reply
* [GIT] Networking
From: David Miller @ 2014-12-29 21:33 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
1) Fix double SKB free in bluetooth 6lowpan layer, from Jukka
Rissanen.
2) Fix receive checksum handling in enic driver, from Govindarajulu
Varadarajan.
3) Fix NAPI poll list corruption in virtio_net and caif_virtio, from
Herbert Xu. Also, add code to detect drivers that have this
mistake in the future.
4) Fix doorbell endianness handling in mlx4 driver, from Amir Vadai.
5) Don't clobber IP6CB() before xfrm6_policy_check() is called in
TCP input path,f rom Nicolas Dichtel.
6) Fix MPLS action validation in openvswitch, from Pravin B Shelar.
7) Fix double SKB free in vxlan driver, also from Pravin.
8) When we scrub a packet, which happens when we are switching the
context of the packet (namespace, etc.), we should reset the
secmark. From Thomas Graf.
9) ->ndo_gso_check() needs to do more than return true/false, it
also has to allow the driver to clear netdev feature bits in
order for the caller to be able to proceed properly. From
Jesse Gross.
Please pull, thanks a lot!
The following changes since commit d790be3863b28fd22e0781c1a3ddefcbfd5f7086:
Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux (2014-12-18 20:55:41 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
for you to fetch changes up to dc97a1a9477f969e34b38ca9d9cd231cb93ebea2:
genetlink: A genl_bind() to an out-of-range multicast group should not WARN(). (2014-12-29 16:31:49 -0500)
----------------------------------------------------------------
Al Viro (3):
Bluetooth: hidp_connection_add() unsafe use of l2cap_pi()
Bluetooth: cmtp: cmtp_add_connection() should verify that it's dealing with l2cap socket
Bluetooth: bnep: bnep_add_connection() should verify that it's dealing with l2cap socket
Amir Vadai (1):
net/mlx4_en: Doorbell is byteswapped in Little Endian archs
Antonio Quartulli (1):
batman-adv: avoid NULL dereferences and fix if check
Appana Durga Kedareswara Rao (1):
net: xilinx: Remove unnecessary temac_property in the driver
Dan Collins (1):
packet: Fixed TPACKET V3 to signal poll when block is closed rather than every packet
Daniel Glöckner (1):
net: s6gmac: remove driver
David S. Miller (6):
Merge branch 'for-upstream' of git://git.kernel.org/.../bluetooth/bluetooth
Merge branch 'openvswitch-net'
Merge tag 'wireless-drivers-for-davem-2014-12-26' of git://git.kernel.org/.../kvalo/wireless-drivers
Merge branch 'for-upstream' of git://git.kernel.org/.../bluetooth/bluetooth
Merge branch 'netlink_multicast'
genetlink: A genl_bind() to an out-of-range multicast group should not WARN().
Eliad Peller (1):
iwlwifi: mvm: clear IN_HW_RESTART flag on stop()
Emmanuel Grumbach (3):
iwlwifi: pcie: re-ACK all interrupts after device reset
iwlwifi: don't double free a pointer if no FW was found
iwlwifi: add new device IDs for 3165
Govindarajulu Varadarajan (1):
enic: fix rx skb checksum
Haiyang Zhang (1):
hyperv: Fix some variable name typos in send-buffer init/revoke
Hariprasad Shenai (1):
cxgb4vf: Fix ethtool get_settings for VF driver
Herbert Xu (6):
virtio_net: Fix napi poll list corruption
caif: Fix napi poll list corruption
net: Move napi polling code out of net_rx_action
net: Detect drivers that reschedule NAPI and exhaust budget
net: Always poll at least one device in net_rx_action
net: Rearrange loop in net_rx_action
Huacai Chen (1):
stmmac: Don't init ptp again when resume from suspend/hibernation
Jason Wang (1):
net: drop the packet when fails to do software segmentation or header check
Jay Vosburgh (1):
net/core: Handle csum for CHECKSUM_COMPLETE VXLAN forwarding
Jesse Gross (1):
net: Generalize ndo_gso_check to ndo_features_check
Jia-Ju Bai (3):
8139too: Fix the lack of pci_disable_device
8139too: Add netif_napi_del in the driver
ne2k-pci: Add pci_disable_device in error handling
Johan Hedberg (1):
Bluetooth: Fix accepting connections when not using mgmt
Johan Hovold (1):
net: phy: micrel: use generic config_init for KSZ8021/KSZ8031
Johannes Berg (6):
netlink: rename netlink_unbind() to netlink_undo_bind()
genetlink: pass only network namespace to genl_has_listeners()
netlink: update listeners directly when removing socket
netlink: call unbind when releasing socket
genetlink: pass multicast bind/unbind to families
netlink/genetlink: pass network namespace to bind/unbind
Jukka Rissanen (1):
Bluetooth: 6lowpan: Do not free skb when packet is dropped
Kalle Valo (1):
Merge tag 'iwlwifi-fixes-for-kalle-2014-12-18' of git://git.kernel.org/.../iwlwifi/iwlwifi-fixes
Li RongQing (1):
sunvnet: fix a memory leak in vnet_handle_offloads
Liad Kaufman (1):
iwlwifi: pcie: limit fw chunk sizes given to fh
Marcel Holtmann (1):
Bluetooth: Fix controller configuration with HCI_QUIRK_INVALID_BDADDR
Mika Westerberg (1):
brcmfmac: Do not crash if platform data is not populated
Nicholas Mc Guire (1):
net: incorrect use of init_completion fixup
Nicolas Dichtel (2):
tcp6: don't move IP6CB before xfrm6_policy_check()
neigh: remove next ptr from struct neigh_table
Paul Bolle (1):
ipw2200: select CFG80211_WEXT
Prashant Sreedharan (1):
tg3: tg3_disable_ints using uninitialized mailbox value to disable interrupts
Pravin B Shelar (6):
mpls: Fix config check for mpls.
mpls: Fix allowed protocols for mpls gso
openvswitch: Fix MPLS action validation.
openvswitch: Fix GSO with multiple MPLS label.
openvswitch: Fix vport_send double free
vxlan: Fix double free of skb.
Rickard Strandqvist (1):
net: ethernet: micrel: ksz884x.c: Remove unused function
Sven Eckelmann (2):
batman-adv: Calculate extra tail size based on queued fragments
batman-adv: Unify fragment size calculation
Thomas Graf (1):
net: Reset secmark when scrubbing packet
Toshiaki Makita (1):
net: Fix stacked vlan offload features computation
Wengang Wang (1):
bonding: change error message to debug message in __bond_release_one()
Wolfram Sang (1):
net: ethernet: stmicro: stmmac: drop owner assignment from platform_drivers
Wu Fengguang (1):
openvswitch: fix odd_ptr_err.cocci warnings
stephen hemminger (1):
in6: fix conflict with glibc
drivers/net/bonding/bond_main.c | 2 +-
drivers/net/caif/caif_virtio.c | 2 -
drivers/net/ethernet/8390/ne2k-pci.c | 6 +-
drivers/net/ethernet/Kconfig | 12 -
drivers/net/ethernet/Makefile | 1 -
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 8 +-
drivers/net/ethernet/broadcom/tg3.c | 34 +--
drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 2 +-
drivers/net/ethernet/chelsio/cxgb4vf/adapter.h | 4 +
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 142 ++++++++-
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h | 2 +-
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | 54 ++--
drivers/net/ethernet/cisco/enic/enic_main.c | 12 +-
drivers/net/ethernet/emulex/benet/be_main.c | 8 +-
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 10 +-
drivers/net/ethernet/mellanox/mlx4/en_tx.c | 12 +-
drivers/net/ethernet/micrel/ksz884x.c | 6 -
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 8 +-
drivers/net/ethernet/realtek/8139too.c | 4 +-
drivers/net/ethernet/s6gmac.c | 1058 -----------------------------------------------------------------
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 1 -
drivers/net/ethernet/sun/sunvnet.c | 1 +
drivers/net/ethernet/xilinx/xilinx_axienet.h | 2 -
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 -
drivers/net/hyperv/hyperv_net.h | 1 +
drivers/net/hyperv/netvsc.c | 15 +-
drivers/net/phy/micrel.c | 18 +-
drivers/net/virtio_net.c | 2 -
drivers/net/vxlan.c | 34 ++-
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 4 +-
drivers/net/wireless/ipw2x00/Kconfig | 3 +-
drivers/net/wireless/iwlwifi/iwl-drv.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-fh.h | 1 +
drivers/net/wireless/iwlwifi/mvm/mac80211.c | 15 +-
drivers/net/wireless/iwlwifi/pcie/drv.c | 4 +
drivers/net/wireless/iwlwifi/pcie/trans.c | 17 +-
include/linux/netdevice.h | 20 +-
include/linux/netlink.h | 4 +-
include/net/genetlink.h | 9 +-
include/net/neighbour.h | 1 -
include/net/vxlan.h | 28 +-
include/uapi/linux/in6.h | 3 +-
include/uapi/linux/libc-compat.h | 3 +
kernel/audit.c | 2 +-
net/batman-adv/fragmentation.c | 4 +-
net/batman-adv/gateway_client.c | 2 +-
net/bluetooth/6lowpan.c | 1 -
net/bluetooth/bnep/core.c | 3 +
net/bluetooth/cmtp/core.c | 3 +
net/bluetooth/hci_event.c | 16 +-
net/bluetooth/hidp/core.c | 3 +-
net/core/dev.c | 175 ++++++-----
net/core/skbuff.c | 1 +
net/ipv4/geneve.c | 6 +-
net/ipv6/tcp_ipv6.c | 45 ++-
net/mpls/mpls_gso.c | 5 +-
net/netfilter/nfnetlink.c | 2 +-
net/netlink/af_netlink.c | 38 ++-
net/netlink/af_netlink.h | 8 +-
net/netlink/genetlink.c | 56 ++++
net/openvswitch/actions.c | 3 +-
net/openvswitch/datapath.c | 3 +-
net/openvswitch/flow_netlink.c | 13 +-
net/openvswitch/vport-geneve.c | 3 +
net/openvswitch/vport-gre.c | 18 +-
net/openvswitch/vport-vxlan.c | 2 +
net/openvswitch/vport.c | 5 +-
net/packet/af_packet.c | 11 +-
69 files changed, 628 insertions(+), 1393 deletions(-)
delete mode 100644 drivers/net/ethernet/s6gmac.c
^ permalink raw reply
* Re: net.git: Call-trace after "Merge branch 'netlink_multicast'"
From: David Miller @ 2014-12-29 21:33 UTC (permalink / raw)
To: sedat.dilek; +Cc: johannes.berg, netdev, fengguang.wu
In-Reply-To: <CA+icZUUO5fkmdevyhutYU6=2vBACN0Nr3WA+DMssfhy5xfsrbQ@mail.gmail.com>
From: Sedat Dilek <sedat.dilek@gmail.com>
Date: Sun, 28 Dec 2014 10:34:51 +0100
> On Sun, Dec 28, 2014 at 8:54 AM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
>> Just a small thing, if you look at this...
>>
>> With gcc-4.9.2 I see this warning in my logs...
>>
>> net/netlink/genetlink.c: In function 'genl_bind':
>> net/netlink/genetlink.c:1018:2: warning: 'err' may be used
>> uninitialized in this function [-Wmaybe-uninitialized]
>>
>
> Attached patch fixes the issue for me.
Ok since the user can request arbitrary multicast groups, we cannot
warn in this situation.
And since initializing 'err' to zero makes the whole 'found'
variable completely unnecessary, we can delete that too.
This is the final patch I am applying, thanks for all of your
help.
====================
[PATCH] genetlink: A genl_bind() to an out-of-range multicast group should not WARN().
Users can request to bind to arbitrary multicast groups, so warning
when the requested group number is out of range is not appropriate.
And with the warning removed, and the 'err' variable properly given
an initial value, we can remove 'found' altogether.
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/netlink/genetlink.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 91566ed..2e11061 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -985,8 +985,7 @@ static struct genl_multicast_group genl_ctrl_groups[] = {
static int genl_bind(struct net *net, int group)
{
- int i, err;
- bool found = false;
+ int i, err = 0;
down_read(&cb_lock);
for (i = 0; i < GENL_FAM_TAB_SIZE; i++) {
@@ -1003,16 +1002,12 @@ static int genl_bind(struct net *net, int group)
err = f->mcast_bind(net, fam_grp);
else
err = 0;
- found = true;
break;
}
}
}
up_read(&cb_lock);
- if (WARN_ON(!found))
- err = 0;
-
return err;
}
--
1.7.11.7
^ permalink raw reply related
* Re: [PATCH] bonding: move ipoib_header_ops to vmlinux
From: Cong Wang @ 2014-12-29 21:32 UTC (permalink / raw)
To: Wengang Wang; +Cc: netdev, linux-rdma
In-Reply-To: <1416893768-21369-1-git-send-email-wen.gang.wang@oracle.com>
On Mon, Nov 24, 2014 at 9:36 PM, Wengang Wang <wen.gang.wang@oracle.com> wrote:
> When last slave of a bonding master is removed, the bonding then does not work.
> At the time if packet_snd is called against with a master net_device, it calls
> then header_ops->create which points to slave's header_ops. In case the slave
> is ipoib and the module is unloaded, header_ops would point to invalid address.
> Accessing it will cause problem.
> This patch tries to fix this issue by moving ipoib_header_ops to vmlinux to keep
> it valid even when ipoib module is unloaded.
>
I still don't think this is the right way to fix the bug, because
there are other modules which have the same bug, for example,
net/bluetooth/6lowpan.c (unless it can't be enslaved into a bond
of course, I haven't verified). We don't want to move them all
to builtin kernel, do we?
On the other hand, as Jay explained, bonding is probably
the only one which has the problem, why not solve it in bonding?
I mean why do we have to adjust other modules just for bonding?
When its slave device gets removed, some netdev event is sent
to the master, so why not reset the header_ops to ether header ops
up on this event? Something like below (not even compile tested):
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 184c434..aedccae 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1726,6 +1726,7 @@ static int __bond_release_one(struct net_device *bond_dev,
if (!bond_has_slaves(bond)) {
bond_set_carrier(bond);
eth_hw_addr_random(bond_dev);
+ ether_setup(bond_dev);
}
unblock_netpoll_tx();
It should solve more than just your ipoib case.
Last but not least, since you said you saw the crash in packet_snd(),
it would also be interesting to know why packet_snd() still picks this
bond dev after all its slaves are gone, after all it is not a functional
device without any slave (its carrier is off).
Thanks.
^ permalink raw reply related
* [PATCH 6/6] bridge: add vlan info to bridge setlink and dellink notification messages
From: roopa @ 2014-12-29 21:05 UTC (permalink / raw)
To: netdev, shemminger, vyasevic; +Cc: Roopa Prabhu
From: Roopa Prabhu <roopa@cumulusnetworks.com>
vlan add/deletes are not notified to userspace today. This patch fixes it.
Notifications will contain vlans compressed into ranges whereever applicable.
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
net/bridge/br_netlink.c | 3 ++-
net/core/rtnetlink.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 16bdd5a..cebfb03 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -303,7 +303,8 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port)
if (skb == NULL)
goto errout;
- err = br_fill_ifinfo(skb, port, 0, 0, event, 0, 0, port->dev);
+ err = br_fill_ifinfo(skb, port, 0, 0, event, 0,
+ RTEXT_FILTER_BRVLAN_COMPRESSED, port->dev);
if (err < 0) {
/* -EMSGSIZE implies BUG in br_nlmsg_size() */
WARN_ON(err == -EMSGSIZE);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index d06107d..dad5fb6 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2878,7 +2878,8 @@ static int rtnl_bridge_notify(struct net_device *dev, u16 flags)
if ((!flags || (flags & BRIDGE_FLAGS_MASTER)) &&
br_dev && br_dev->netdev_ops->ndo_bridge_getlink) {
- err = br_dev->netdev_ops->ndo_bridge_getlink(skb, 0, 0, dev, 0);
+ err = br_dev->netdev_ops->ndo_bridge_getlink(skb, 0, 0, dev,
+ RTEXT_FILTER_BRVLAN_COMPRESSED);
if (err < 0)
goto errout;
}
--
1.7.10.4
^ permalink raw reply related
* [PATCH 5/6] bridge: new function to pack vlans using both IFLA_BRIDGE_VLAN_INFO and IFLA_BRIDGE_VLAN_RANGE_INFO
From: roopa @ 2014-12-29 21:05 UTC (permalink / raw)
To: netdev, shemminger, vyasevic; +Cc: Roopa Prabhu, Wilson kok
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This patch adds new function to compress vlans into ranges.
Vlans are compressed into ranges only if the fill request is called with
RTEXT_FILTER_BRVLAN_COMPRESSED in filtermask.
Old vlan packing code is moved to a new function and continues to be
called when filter_mask is RTEXT_FILTER_BRVLAN
Signed-off-by: Wilson kok <wkok@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
net/bridge/br_netlink.c | 157 +++++++++++++++++++++++++++++++++++++++++------
1 file changed, 137 insertions(+), 20 deletions(-)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 4c47ba0..16bdd5a 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -67,6 +67,133 @@ static int br_port_fill_attrs(struct sk_buff *skb,
return 0;
}
+static int br_fill_ifvlaninfo_bitmap(struct sk_buff *skb,
+ const unsigned long *vlan_bmp, u16 flags)
+{
+ struct bridge_vlan_range_info vinfo_range;
+ struct bridge_vlan_info vinfo;
+ u16 vid, start = 0, end = 0;
+ u16 pvid;
+
+ /* handle the untagged */
+ for_each_set_bit(vid, vlan_bmp, VLAN_N_VID) {
+ if (start == 0) {
+ start = vid;
+ end = vid;
+ }
+ if ((vid - end) > 1) {
+ memset(&vinfo_range, 0, sizeof(vinfo_range));
+ vinfo_range.flags |= flags;
+ vinfo_range.vid = start;
+ vinfo_range.vid_end = end;
+ if (nla_put(skb, IFLA_BRIDGE_VLAN_RANGE_INFO,
+ sizeof(vinfo_range), &vinfo_range))
+ goto nla_put_failure;
+ start = vid;
+ end = vid;
+ } else {
+ end = vid;
+ }
+ }
+
+ if (start != 0 && end != 0) {
+ if (start != end) {
+ memset(&vinfo_range, 0, sizeof(vinfo_range));
+ vinfo_range.flags |= flags;
+ vinfo_range.vid = start;
+ vinfo_range.vid_end = end;
+ if (nla_put(skb, IFLA_BRIDGE_VLAN_RANGE_INFO,
+ sizeof(vinfo_range), &vinfo_range))
+ goto nla_put_failure;
+ } else {
+ memset(&vinfo, 0, sizeof(vinfo));
+ vinfo.flags |= flags;
+ vinfo.vid = start;
+ if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
+ sizeof(vinfo), &vinfo))
+ goto nla_put_failure;
+ }
+ }
+
+nla_put_failure:
+ return -EMSGSIZE;
+}
+
+static int br_fill_ifvlaninfo_compressed(struct sk_buff *skb,
+ const struct net_port_vlans *pv)
+{
+ unsigned long vlan_bmp_copy[BR_VLAN_BITMAP_LEN];
+ unsigned long untagged_bmp_copy[BR_VLAN_BITMAP_LEN];
+ struct bridge_vlan_range_info vinfo_range;
+ struct bridge_vlan_info vinfo;
+ u16 pvid;
+
+ memset(vlan_bmp_copy, 0,
+ sizeof(unsigned long) * BR_VLAN_BITMAP_LEN);
+ bitmap_copy(vlan_bmp_copy, pv->vlan_bitmap, VLAN_N_VID);
+
+ memset(untagged_bmp_copy, 0,
+ sizeof(unsigned long) * BR_VLAN_BITMAP_LEN);
+ bitmap_copy(untagged_bmp_copy, pv->untagged_bitmap, VLAN_N_VID);
+
+ /* send the pvid separately first */
+ pvid = br_get_pvid(pv);
+ if (pvid && (pvid != VLAN_N_VID)) {
+ memset(&vinfo, 0, sizeof(vinfo));
+ vinfo.flags |= BRIDGE_VLAN_INFO_PVID;
+ if (test_bit(pvid, untagged_bmp_copy)) {
+ vinfo.flags |= BRIDGE_VLAN_INFO_UNTAGGED;
+ clear_bit(pvid, untagged_bmp_copy);
+ }
+ clear_bit(pvid, vlan_bmp_copy);
+ vinfo.vid = pvid;
+ if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
+ sizeof(vinfo), &vinfo))
+ goto nla_put_failure;
+ }
+
+ /* fill untagged vlans */
+ br_fill_ifvlaninfo_bitmap(skb, untagged_bmp_copy,
+ BRIDGE_VLAN_INFO_UNTAGGED);
+ for_each_set_bit(vid, untagged_bmp_copy, VLAN_N_VID)
+ clear_bit(vid, vlan_bmp_copy);
+
+ /* fill tagged vlans */
+ br_fill_ifvlaninfo_bitmap(skb, vlan_bmp_copy, 0);
+
+ return 0;
+
+nla_put_failure:
+ return -EMSGSIZE;
+}
+
+static int br_fill_ifvlaninfo(struct sk_buff *skb,
+ const struct net_port_vlans *pv)
+{
+ struct bridge_vlan_info vinfo;
+ u16 pvid, vid;
+
+ pvid = br_get_pvid(pv);
+ for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
+ vinfo.vid = vid;
+ vinfo.flags = 0;
+ if (vid == pvid)
+ vinfo.flags |= BRIDGE_VLAN_INFO_PVID;
+
+ if (test_bit(vid, pv->untagged_bitmap))
+ vinfo.flags |= BRIDGE_VLAN_INFO_UNTAGGED;
+
+ if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
+ sizeof(vinfo), &vinfo))
+ goto nla_put_failure;
+ }
+
+ return 0;
+
+nla_put_failure:
+ return -EMSGSIZE;
+}
+
/*
* Create one netlink message for one interface
* Contains port and master info as well as carrier and bridge state.
@@ -121,12 +248,11 @@ static int br_fill_ifinfo(struct sk_buff *skb,
}
/* Check if the VID information is requested */
- if (filter_mask & RTEXT_FILTER_BRVLAN) {
- struct nlattr *af;
+ if ((filter_mask & RTEXT_FILTER_BRVLAN) ||
+ (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)) {
const struct net_port_vlans *pv;
- struct bridge_vlan_info vinfo;
- u16 vid;
- u16 pvid;
+ struct nlattr *af;
+ int err;
if (port)
pv = nbp_get_vlan_info(port);
@@ -140,21 +266,12 @@ static int br_fill_ifinfo(struct sk_buff *skb,
if (!af)
goto nla_put_failure;
- pvid = br_get_pvid(pv);
- for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
- vinfo.vid = vid;
- vinfo.flags = 0;
- if (vid == pvid)
- vinfo.flags |= BRIDGE_VLAN_INFO_PVID;
-
- if (test_bit(vid, pv->untagged_bitmap))
- vinfo.flags |= BRIDGE_VLAN_INFO_UNTAGGED;
-
- if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
- sizeof(vinfo), &vinfo))
- goto nla_put_failure;
- }
-
+ if (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)
+ err = br_fill_ifvlaninfo_compressed(skb, pv);
+ else
+ err = br_fill_ifvlaninfo(skb, pv);
+ if (err)
+ goto nla_put_failure;
nla_nest_end(skb, af);
}
--
1.7.10.4
^ permalink raw reply related
* [PATCH 4/6] rtnetlink: new filter RTEXT_FILTER_BRVLAN_COMPRESSED
From: roopa @ 2014-12-29 21:05 UTC (permalink / raw)
To: netdev, shemminger, vyasevic; +Cc: Roopa Prabhu
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This filter is same as RTEXT_FILTER_BRVLAN except that it tries
to compress the consecutive vlans into ranges.
This helps on systems with large number of configured vlans.
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
include/uapi/linux/rtnetlink.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index 9c9b8b4..d5a5316 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -634,6 +634,7 @@ struct tcamsg {
/* New extended info filters for IFLA_EXT_MASK */
#define RTEXT_FILTER_VF (1 << 0)
#define RTEXT_FILTER_BRVLAN (1 << 1)
+#define RTEXT_FILTER_BRVLAN_COMPRESSED (1 << 2)
/* End of information exported to user level */
--
1.7.10.4
^ permalink raw reply related
* [PATCH 2/6] bridge: add new attribute IFLA_BRIDGE_VLAN_RANGE_INFO to represent vlan range
From: roopa @ 2014-12-29 21:05 UTC (permalink / raw)
To: netdev, shemminger, vyasevic; +Cc: Roopa Prabhu, Wilson Kok
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This patch adds new bridge netlink attribute IFLA_BRIDGE_VLAN_RANGE_INFO
to represent vlan range.
Current IFLA_BRIDGE_VLAN_INFO attribute represents a single vlan and
does not scale well when the port has large number of vlans.
IFLA_BRIDGE_VLAN_RANGE_INFO is similar to IFLA_BRIDGE_VLAN_INFO but helps
with packing consecutive vlans in a single attribute. Thus reducing the
size of the netlink msg during adds and also during dumps.
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
---
include/uapi/linux/if_bridge.h | 7 +++++++
net/bridge/br_netlink.c | 2 ++
2 files changed, 9 insertions(+)
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index b03ee8f..d41a346 100644
--- a/include/uapi/linux/if_bridge.h
+++ b/include/uapi/linux/if_bridge.h
@@ -118,6 +118,7 @@ enum {
IFLA_BRIDGE_FLAGS,
IFLA_BRIDGE_MODE,
IFLA_BRIDGE_VLAN_INFO,
+ IFLA_BRIDGE_VLAN_RANGE_INFO,
__IFLA_BRIDGE_MAX,
};
#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
@@ -131,6 +132,12 @@ struct bridge_vlan_info {
__u16 vid;
};
+struct bridge_vlan_range_info {
+ __u16 flags;
+ __u16 vid;
+ __u16 vid_end;
+};
+
/* Bridge multicast database attributes
* [MDBA_MDB] = {
* [MDBA_MDB_ENTRY] = {
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 75971b1..e7d1fc0 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -223,6 +223,8 @@ static const struct nla_policy ifla_br_policy[IFLA_MAX+1] = {
[IFLA_BRIDGE_MODE] = { .type = NLA_U16 },
[IFLA_BRIDGE_VLAN_INFO] = { .type = NLA_BINARY,
.len = sizeof(struct bridge_vlan_info), },
+ [IFLA_BRIDGE_VLAN_RANGE_INFO] = { .type = NLA_BINARY,
+ .len = sizeof(struct bridge_vlan_range_info), },
};
static int br_afspec(struct net_bridge *br,
--
1.7.10.4
^ permalink raw reply related
* [PATCH 3/6] bridge: modify IFLA_AF_SPEC parser to parse IFLA_BRIDGE_VLAN_RANGE_INFO
From: roopa @ 2014-12-29 21:05 UTC (permalink / raw)
To: netdev, shemminger, vyasevic; +Cc: Roopa Prabhu, Wilson kok
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This patch modifies br_afspec to parse incoming IFLA_BRIDGE_VLAN_RANGE_INFO
Signed-off-by: Wilson kok <wkok@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
net/bridge/br_netlink.c | 70 +++++++++++++++++++++++++++++++++--------------
1 file changed, 49 insertions(+), 21 deletions(-)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index e7d1fc0..4c47ba0 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -227,48 +227,76 @@ static const struct nla_policy ifla_br_policy[IFLA_MAX+1] = {
.len = sizeof(struct bridge_vlan_range_info), },
};
+static int br_afspec_vlan_add(struct net_bridge *br,
+ struct net_bridge_port *p,
+ u16 vid, u16 flags)
+{
+ int err = 0;
+
+ if (p) {
+ err = nbp_vlan_add(p, vid, flags);
+ if (err)
+ return err;
+
+ if (flags & BRIDGE_VLAN_INFO_MASTER)
+ err = br_vlan_add(p->br, vid, flags);
+ } else {
+ err = br_vlan_add(br, vid, flags);
+ }
+
+ return err;
+}
+
+static void br_afspec_vlan_del(struct net_bridge *br,
+ struct net_bridge_port *p,
+ u16 vid, u16 flags)
+{
+ if (p) {
+ nbp_vlan_delete(p, vid);
+ if (flags & BRIDGE_VLAN_INFO_MASTER)
+ br_vlan_delete(p->br, vid);
+ } else {
+ br_vlan_delete(br, vid);
+ }
+}
+
static int br_afspec(struct net_bridge *br,
struct net_bridge_port *p,
struct nlattr *af_spec,
int cmd)
{
- struct bridge_vlan_info *vinfo;
- int err = 0;
+ struct bridge_vlan_range_info *vinfo;
struct nlattr *attr;
int err = 0;
int rem;
u16 vid;
nla_for_each_nested(attr, af_spec, rem) {
- if (nla_type(attr) != IFLA_BRIDGE_VLAN_INFO)
+ if (nla_type(attr) != IFLA_BRIDGE_VLAN_INFO &&
+ nla_type(attr) != IFLA_BRIDGE_VLAN_RANGE_INFO)
continue;
-
vinfo = nla_data(attr);
- if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK)
+
+ if (nla_type(attr) == IFLA_BRIDGE_VLAN_INFO)
+ vinfo->vid_end = vinfo->vid;
+
+ if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK ||
+ vinfo->vid_end >= VLAN_VID_MASK ||
+ vinfo->vid > vinfo->vid_end)
return -EINVAL;
switch (cmd) {
case RTM_SETLINK:
- if (p) {
- err = nbp_vlan_add(p, vinfo->vid, vinfo->flags);
+ for (vid = vinfo->vid; vid <= vinfo->vid_end; vid++) {
+ err = br_afspec_vlan_add(br, p, vid,
+ vinfo->flags);
if (err)
break;
-
- if (vinfo->flags & BRIDGE_VLAN_INFO_MASTER)
- err = br_vlan_add(p->br, vinfo->vid,
- vinfo->flags);
- } else
- err = br_vlan_add(br, vinfo->vid, vinfo->flags);
-
+ }
break;
-
case RTM_DELLINK:
- if (p) {
- nbp_vlan_delete(p, vinfo->vid);
- if (vinfo->flags & BRIDGE_VLAN_INFO_MASTER)
- br_vlan_delete(p->br, vinfo->vid);
- } else
- br_vlan_delete(br, vinfo->vid);
+ for (vid = vinfo->vid; vid <= vinfo->vid_end; vid++)
+ br_afspec_vlan_del(br, p, vid, vinfo->flags);
break;
}
}
--
1.7.10.4
^ permalink raw reply related
* [PATCH 1/6] bridge: add support to parse multiple vlan info attributes in IFLA_AF_SPEC
From: roopa @ 2014-12-29 21:05 UTC (permalink / raw)
To: netdev, shemminger, vyasevic; +Cc: Roopa Prabhu
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This patch changes bridge IFLA_AF_SPEC netlink attribute parser to
look for more than one IFLA_BRIDGE_VLAN_INFO attribute. This allows
userspace to pack more than one vlan in the setlink msg.
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
net/bridge/br_netlink.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 9f5eb55..75971b1 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -230,18 +230,18 @@ static int br_afspec(struct net_bridge *br,
struct nlattr *af_spec,
int cmd)
{
- struct nlattr *tb[IFLA_BRIDGE_MAX+1];
+ struct bridge_vlan_info *vinfo;
int err = 0;
+ struct nlattr *attr;
+ int err = 0;
+ int rem;
+ u16 vid;
- err = nla_parse_nested(tb, IFLA_BRIDGE_MAX, af_spec, ifla_br_policy);
- if (err)
- return err;
-
- if (tb[IFLA_BRIDGE_VLAN_INFO]) {
- struct bridge_vlan_info *vinfo;
-
- vinfo = nla_data(tb[IFLA_BRIDGE_VLAN_INFO]);
+ nla_for_each_nested(attr, af_spec, rem) {
+ if (nla_type(attr) != IFLA_BRIDGE_VLAN_INFO)
+ continue;
+ vinfo = nla_data(attr);
if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK)
return -EINVAL;
--
1.7.10.4
^ permalink raw reply related
* [PATCH 0/6] bridge: suport for vlan range and vlan add/del notifications
From: roopa @ 2014-12-29 21:05 UTC (permalink / raw)
To: netdev, shemminger, vyasevic; +Cc: Roopa Prabhu, Wilson Kok
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This series adds new netlink attribute to represent vlan range.
Enables bridge link notify msgs to send vlan information.
Will post corresponding iproute2 patches if these get accepted.
Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Roopa Prabhu (6):
bridge: add support to parse multiple vlan info attributes in
IFLA_AF_SPEC
bridge: add new attribute IFLA_BRIDGE_VLAN_RANGE_INFO to represent
vlan range
bridge: modify IFLA_AF_SPEC parser to parse
IFLA_BRIDGE_VLAN_RANGE_INFO
rtnetlink: new filter RTEXT_FILTER_BRVLAN_COMPRESSED
bridge: new function to pack vlans using both IFLA_BRIDGE_VLAN_INFO
and IFLA_BRIDGE_VLAN_RANGE_INFO
bridge: add vlan info to bridge setlink and dellink notification
messages
include/uapi/linux/if_bridge.h | 7 ++
include/uapi/linux/rtnetlink.h | 1 +
net/bridge/br_netlink.c | 240 ++++++++++++++++++++++++++++++++--------
net/core/rtnetlink.c | 3 +-
4 files changed, 204 insertions(+), 47 deletions(-)
--
1.7.10.4
^ permalink raw reply
* [PATCH iproute2 v2] bridge/link: add learning_sync policy flag
From: sfeldma @ 2014-12-29 20:20 UTC (permalink / raw)
To: stephen, netdev, jiri, roopa
From: Scott Feldman <sfeldma@gmail.com>
v2:
Resending now that the dust has cleared in 3.18 on "self" vs. hwmode debate for
brport settings. learning_sync is now set/cleared using "self" qualifier on
brport.
v1:
Add 'learned_sync' flag to turn on/off syncing of learned MAC addresses from
offload device to bridge's FDB. Flag is be set/cleared on offload device port
using "self" qualifier:
$ sudo bridge link set dev swp1 learning_sync on self
$ bridge -d link show dev swp1
2: swp1 state UNKNOWN : <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0 state forwarding priority 32 cost 2
hairpin off guard off root_block off fastleave off learning off flood off
2: swp1 state UNKNOWN : <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0
learning on learning_sync on
Adds new IFLA_BRPORT_LEARNED_SYNCED attribute for IFLA_PROTINFO on the SELF
brport.
Signed-off-by: Scott Feldman <sfeldma@gmail.com>
---
bridge/link.c | 12 ++++++++++++
man/man8/bridge.8 | 6 ++++++
2 files changed, 18 insertions(+)
diff --git a/bridge/link.c b/bridge/link.c
index 3f77aab..c8555f8 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -188,6 +188,9 @@ int print_linkinfo(const struct sockaddr_nl *who,
if (prtb[IFLA_BRPORT_LEARNING])
print_onoff(fp, "learning",
rta_getattr_u8(prtb[IFLA_BRPORT_LEARNING]));
+ if (prtb[IFLA_BRPORT_LEARNING_SYNC])
+ print_onoff(fp, "learning_sync",
+ rta_getattr_u8(prtb[IFLA_BRPORT_LEARNING_SYNC]));
if (prtb[IFLA_BRPORT_UNICAST_FLOOD])
print_onoff(fp, "flood",
rta_getattr_u8(prtb[IFLA_BRPORT_UNICAST_FLOOD]));
@@ -221,6 +224,7 @@ static void usage(void)
fprintf(stderr, " [ fastleave {on | off} ]\n");
fprintf(stderr, " [ root_block {on | off} ]\n");
fprintf(stderr, " [ learning {on | off} ]\n");
+ fprintf(stderr, " [ learning_sync {on | off} ]\n");
fprintf(stderr, " [ flood {on | off} ]\n");
fprintf(stderr, " [ hwmode {vepa | veb} ]\n");
fprintf(stderr, " bridge link show [dev DEV]\n");
@@ -252,6 +256,7 @@ static int brlink_modify(int argc, char **argv)
} req;
char *d = NULL;
__s8 learning = -1;
+ __s8 learning_sync = -1;
__s8 flood = -1;
__s8 hairpin = -1;
__s8 bpdu_guard = -1;
@@ -295,6 +300,10 @@ static int brlink_modify(int argc, char **argv)
NEXT_ARG();
if (!on_off("learning", &learning, *argv))
exit(-1);
+ } else if (strcmp(*argv, "learning_sync") == 0) {
+ NEXT_ARG();
+ if (!on_off("learning_sync", &learning_sync, *argv))
+ exit(-1);
} else if (strcmp(*argv, "flood") == 0) {
NEXT_ARG();
if (!on_off("flood", &flood, *argv))
@@ -359,6 +368,9 @@ static int brlink_modify(int argc, char **argv)
addattr8(&req.n, sizeof(req), IFLA_BRPORT_UNICAST_FLOOD, flood);
if (learning >= 0)
addattr8(&req.n, sizeof(req), IFLA_BRPORT_LEARNING, learning);
+ if (learning_sync >= 0)
+ addattr8(&req.n, sizeof(req), IFLA_BRPORT_LEARNING_SYNC,
+ learning_sync);
if (cost > 0)
addattr32(&req.n, sizeof(req), IFLA_BRPORT_COST, cost);
diff --git a/man/man8/bridge.8 b/man/man8/bridge.8
index cb3fb46..e344db2 100644
--- a/man/man8/bridge.8
+++ b/man/man8/bridge.8
@@ -38,6 +38,7 @@ bridge \- show / manipulate bridge addresses and devices
.BR fastleave " { " on " | " off " } ] [ "
.BR root_block " { " on " | " off " } ] [ "
.BR learning " { " on " | " off " } ] [ "
+.BR learning_sync " { " on " | " off " } ] [ "
.BR flood " { " on " | " off " } ] [ "
.BR hwmode " { " vepa " | " veb " } ] "
@@ -263,6 +264,11 @@ not. If learning if off, the bridge will end up flooding any traffic for which
it has no FDB entry. By default this flag is on.
.TP
+.BR "learning_sync on " or " learning_sync off "
+Controls whether a given port will sync MAC addresses learned on device port to
+bridge FDB.
+
+.TP
.BR "flooding on " or " flooding off "
Controls whether a given port will flood unicast traffic for which there is no FDB entry. By default this flag is on.
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH] bonding: move ipoib_header_ops to vmlinux
From: David Miller @ 2014-12-29 18:36 UTC (permalink / raw)
To: wen.gang.wang-QHcLZuEGTsvQT0dZR+AlfA
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <54A0FEA4.1080302-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
From: Wengang <wen.gang.wang-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Date: Mon, 29 Dec 2014 15:11:32 +0800
> So, what information else do you need?
I need a patch formally (re-)submitted.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox