Skip to content

Commit 6271037

Browse files
committed
Merge branch 'bridge_mode'
Roopa Prabhu says: ==================== remove bridge mode BRIDGE_MODE_SWDEV BRIDGE_MODE_SWDEV was introduced to indicate switchdev offloads for bridging from user space (In other words to call into the hw switch port driver directly). But user can use existing BRIDGE_FLAGS_SELF to call into the hw switch port driver today. swdev mode is not required anymore. So, this patch removes it. v4 - v5 incorporate comments - Define BRIDGE_MODE_UNDEF to handle cases where mode is not defined - reverse the order of patches - include patch comments in all patches ==================== Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents b5f185f + 4a5fdfe commit 6271037

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

drivers/net/ethernet/rocker/rocker.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3717,27 +3717,11 @@ static int rocker_port_bridge_setlink(struct net_device *dev,
37173717
{
37183718
struct rocker_port *rocker_port = netdev_priv(dev);
37193719
struct nlattr *protinfo;
3720-
struct nlattr *afspec;
37213720
struct nlattr *attr;
3722-
u16 mode;
37233721
int err;
37243722

37253723
protinfo = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg),
37263724
IFLA_PROTINFO);
3727-
afspec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC);
3728-
3729-
if (afspec) {
3730-
attr = nla_find_nested(afspec, IFLA_BRIDGE_MODE);
3731-
if (attr) {
3732-
if (nla_len(attr) < sizeof(mode))
3733-
return -EINVAL;
3734-
3735-
mode = nla_get_u16(attr);
3736-
if (mode != BRIDGE_MODE_SWDEV)
3737-
return -EINVAL;
3738-
}
3739-
}
3740-
37413725
if (protinfo) {
37423726
attr = nla_find_nested(protinfo, IFLA_BRPORT_LEARNING);
37433727
if (attr) {
@@ -3772,7 +3756,7 @@ static int rocker_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
37723756
u32 filter_mask)
37733757
{
37743758
struct rocker_port *rocker_port = netdev_priv(dev);
3775-
u16 mode = BRIDGE_MODE_SWDEV;
3759+
u16 mode = BRIDGE_MODE_UNDEF;
37763760
u32 mask = BR_LEARNING | BR_LEARNING_SYNC;
37773761

37783762
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode,

include/uapi/linux/if_bridge.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ struct __fdb_entry {
105105

106106
#define BRIDGE_MODE_VEB 0 /* Default loopback mode */
107107
#define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */
108-
#define BRIDGE_MODE_SWDEV 2 /* Full switch device offload */
108+
#define BRIDGE_MODE_UNDEF 0xFFFF /* mode undefined */
109109

110110
/* Bridge management nested attributes
111111
* [IFLA_AF_SPEC] = {

net/core/rtnetlink.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,11 +2751,17 @@ int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
27512751
if (!br_afspec)
27522752
goto nla_put_failure;
27532753

2754-
if (nla_put_u16(skb, IFLA_BRIDGE_FLAGS, BRIDGE_FLAGS_SELF) ||
2755-
nla_put_u16(skb, IFLA_BRIDGE_MODE, mode)) {
2754+
if (nla_put_u16(skb, IFLA_BRIDGE_FLAGS, BRIDGE_FLAGS_SELF)) {
27562755
nla_nest_cancel(skb, br_afspec);
27572756
goto nla_put_failure;
27582757
}
2758+
2759+
if (mode != BRIDGE_MODE_UNDEF) {
2760+
if (nla_put_u16(skb, IFLA_BRIDGE_MODE, mode)) {
2761+
nla_nest_cancel(skb, br_afspec);
2762+
goto nla_put_failure;
2763+
}
2764+
}
27592765
nla_nest_end(skb, br_afspec);
27602766

27612767
protinfo = nla_nest_start(skb, IFLA_PROTINFO | NLA_F_NESTED);

0 commit comments

Comments
 (0)