* [PATCH v3 iproute2] bridge link: add option 'self'
@ 2014-12-06 8:21 roopa
2014-12-06 17:12 ` Scott Feldman
2014-12-08 11:06 ` Jiri Pirko
0 siblings, 2 replies; 4+ messages in thread
From: roopa @ 2014-12-06 8:21 UTC (permalink / raw
To: jiri, sfeldma, jhs, bcrl, tgraf, john.fastabend, stephen,
linville, vyasevic
Cc: netdev, davem, shm, gospo, Roopa Prabhu
From: Roopa Prabhu <roopa@cumulusnetworks.com>
Currently self is set internally only if hwmode is set.
This makes it necessary for the hw to have a mode.
There is no hwmode really required to go to hardware. So, introduce
self for anybody who wants to target hardware.
v1 -> v2
- fix a few bugs. Initialize flags to zero: this was required to
keep the current behaviour unchanged.
v2 -> v3
- fix comment
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
bridge/link.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/bridge/link.c b/bridge/link.c
index 90d9e7f..3f77aab 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -261,7 +261,7 @@ static int brlink_modify(int argc, char **argv)
__s16 priority = -1;
__s8 state = -1;
__s16 mode = -1;
- __u16 flags = BRIDGE_FLAGS_MASTER;
+ __u16 flags = 0;
struct rtattr *nest;
memset(&req, 0, sizeof(req));
@@ -321,6 +321,8 @@ static int brlink_modify(int argc, char **argv)
"\"veb\".\n");
exit(-1);
}
+ } else if (strcmp(*argv, "self") == 0) {
+ flags = BRIDGE_FLAGS_SELF;
} else {
usage();
}
@@ -369,16 +371,16 @@ static int brlink_modify(int argc, char **argv)
addattr_nest_end(&req.n, nest);
- /* IFLA_AF_SPEC nested attribute. Contains IFLA_BRIDGE_FLAGS that
- * designates master or self operation as well as 'vepa' or 'veb'
- * operation modes. These are only valid in 'self' mode on some
- * devices so far. Thus we only need to include the flags attribute
- * if we are setting the hw mode.
+ /* IFLA_AF_SPEC nested attribute. Contains IFLA_BRIDGE_FLAGS that
+ * designates master or self operation and IFLA_BRIDGE_MODE
+ * for hw 'vepa' or 'veb' operation modes. The hwmodes are
+ * only valid in 'self' mode on some devices so far.
*/
- if (mode >= 0) {
+ if (mode >= 0 || flags > 0) {
nest = addattr_nest(&req.n, sizeof(req), IFLA_AF_SPEC);
- addattr16(&req.n, sizeof(req), IFLA_BRIDGE_FLAGS, flags);
+ if (flags > 0)
+ addattr16(&req.n, sizeof(req), IFLA_BRIDGE_FLAGS, flags);
if (mode >= 0)
addattr16(&req.n, sizeof(req), IFLA_BRIDGE_MODE, mode);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3 iproute2] bridge link: add option 'self'
2014-12-06 8:21 [PATCH v3 iproute2] bridge link: add option 'self' roopa
@ 2014-12-06 17:12 ` Scott Feldman
2014-12-24 20:30 ` Stephen Hemminger
2014-12-08 11:06 ` Jiri Pirko
1 sibling, 1 reply; 4+ messages in thread
From: Scott Feldman @ 2014-12-06 17:12 UTC (permalink / raw
To: Roopa Prabhu
Cc: Jiří Pírko, Jamal Hadi Salim, Benjamin LaHaise,
Thomas Graf, john fastabend, stephen@networkplumber.org,
John Linville, vyasevic@redhat.com, Netdev, David S. Miller,
shm@cumulusnetworks.com, Andy Gospodarek
Signed-of-by: Scott Feldman <sfeldma@gmail.com>
On Sat, Dec 6, 2014 at 12:21 AM, <roopa@cumulusnetworks.com> wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> Currently self is set internally only if hwmode is set.
> This makes it necessary for the hw to have a mode.
> There is no hwmode really required to go to hardware. So, introduce
> self for anybody who wants to target hardware.
>
> v1 -> v2
> - fix a few bugs. Initialize flags to zero: this was required to
> keep the current behaviour unchanged.
>
> v2 -> v3
> - fix comment
>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> ---
> bridge/link.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/bridge/link.c b/bridge/link.c
> index 90d9e7f..3f77aab 100644
> --- a/bridge/link.c
> +++ b/bridge/link.c
> @@ -261,7 +261,7 @@ static int brlink_modify(int argc, char **argv)
> __s16 priority = -1;
> __s8 state = -1;
> __s16 mode = -1;
> - __u16 flags = BRIDGE_FLAGS_MASTER;
> + __u16 flags = 0;
> struct rtattr *nest;
>
> memset(&req, 0, sizeof(req));
> @@ -321,6 +321,8 @@ static int brlink_modify(int argc, char **argv)
> "\"veb\".\n");
> exit(-1);
> }
> + } else if (strcmp(*argv, "self") == 0) {
> + flags = BRIDGE_FLAGS_SELF;
> } else {
> usage();
> }
> @@ -369,16 +371,16 @@ static int brlink_modify(int argc, char **argv)
>
> addattr_nest_end(&req.n, nest);
>
> - /* IFLA_AF_SPEC nested attribute. Contains IFLA_BRIDGE_FLAGS that
> - * designates master or self operation as well as 'vepa' or 'veb'
> - * operation modes. These are only valid in 'self' mode on some
> - * devices so far. Thus we only need to include the flags attribute
> - * if we are setting the hw mode.
> + /* IFLA_AF_SPEC nested attribute. Contains IFLA_BRIDGE_FLAGS that
> + * designates master or self operation and IFLA_BRIDGE_MODE
> + * for hw 'vepa' or 'veb' operation modes. The hwmodes are
> + * only valid in 'self' mode on some devices so far.
> */
> - if (mode >= 0) {
> + if (mode >= 0 || flags > 0) {
> nest = addattr_nest(&req.n, sizeof(req), IFLA_AF_SPEC);
>
> - addattr16(&req.n, sizeof(req), IFLA_BRIDGE_FLAGS, flags);
> + if (flags > 0)
> + addattr16(&req.n, sizeof(req), IFLA_BRIDGE_FLAGS, flags);
>
> if (mode >= 0)
> addattr16(&req.n, sizeof(req), IFLA_BRIDGE_MODE, mode);
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 iproute2] bridge link: add option 'self'
2014-12-06 8:21 [PATCH v3 iproute2] bridge link: add option 'self' roopa
2014-12-06 17:12 ` Scott Feldman
@ 2014-12-08 11:06 ` Jiri Pirko
1 sibling, 0 replies; 4+ messages in thread
From: Jiri Pirko @ 2014-12-08 11:06 UTC (permalink / raw
To: roopa
Cc: sfeldma, jhs, bcrl, tgraf, john.fastabend, stephen, linville,
vyasevic, netdev, davem, shm, gospo
Sat, Dec 06, 2014 at 09:21:01AM CET, roopa@cumulusnetworks.com wrote:
>From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
>Currently self is set internally only if hwmode is set.
>This makes it necessary for the hw to have a mode.
>There is no hwmode really required to go to hardware. So, introduce
>self for anybody who wants to target hardware.
>
>v1 -> v2
> - fix a few bugs. Initialize flags to zero: this was required to
> keep the current behaviour unchanged.
>
>v2 -> v3
> - fix comment
>
>Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 iproute2] bridge link: add option 'self'
2014-12-06 17:12 ` Scott Feldman
@ 2014-12-24 20:30 ` Stephen Hemminger
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2014-12-24 20:30 UTC (permalink / raw
To: Scott Feldman
Cc: Roopa Prabhu, Jiří Pírko, Jamal Hadi Salim,
Benjamin LaHaise, Thomas Graf, john fastabend, John Linville,
vyasevic@redhat.com, Netdev, David S. Miller,
shm@cumulusnetworks.com, Andy Gospodarek
On Sat, 6 Dec 2014 09:12:51 -0800
Scott Feldman <sfeldma@gmail.com> wrote:
> Signed-of-by: Scott Feldman <sfeldma@gmail.com>
>
> On Sat, Dec 6, 2014 at 12:21 AM, <roopa@cumulusnetworks.com> wrote:
> > From: Roopa Prabhu <roopa@cumulusnetworks.com>
> >
> > Currently self is set internally only if hwmode is set.
> > This makes it necessary for the hw to have a mode.
> > There is no hwmode really required to go to hardware. So, introduce
> > self for anybody who wants to target hardware.
> >
> > v1 -> v2
> > - fix a few bugs. Initialize flags to zero: this was required to
> > keep the current behaviour unchanged.
> >
> > v2 -> v3
> > - fix comment
> >
> > Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Applied to post 3.18 current tree.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-24 20:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-06 8:21 [PATCH v3 iproute2] bridge link: add option 'self' roopa
2014-12-06 17:12 ` Scott Feldman
2014-12-24 20:30 ` Stephen Hemminger
2014-12-08 11:06 ` Jiri Pirko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.