]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iplink: Support VF Trust
authorHiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Fri, 26 Feb 2016 02:40:18 +0000 (02:40 +0000)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 2 Mar 2016 17:26:24 +0000 (09:26 -0800)
Add IFLA_VF_TRUST message to trust the VF.
PF can accept some privileged operation from the trusted VF.
For example, ixgbe PF doesn't allow to enable VF promiscuous mode until
the VF is trusted because it may hurt performance.

To trust VF.
 # ip link set dev eth0 vf 1 trust on

To untrust VF.
 # ip link set dev eth0 vf 1 trust off

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
ip/iplink.c
man/man8/ip-link.8.in

index 5ab9d613c4f99d20f3130ef426e55909cb918434..69f50572633b106883cc3f7cb2f69e393aa7c67f 100644 (file)
@@ -82,6 +82,7 @@ void iplink_usage(void)
        fprintf(stderr, "                                  [ spoofchk { on | off} ] ]\n");
        fprintf(stderr, "                                  [ query_rss { on | off} ] ]\n");
        fprintf(stderr, "                                  [ state { auto | enable | disable} ] ]\n");
+       fprintf(stderr, "                                  [ trust { on | off} ] ]\n");
        fprintf(stderr, "                         [ master DEVICE ]\n");
        fprintf(stderr, "                         [ nomaster ]\n");
        fprintf(stderr, "                         [ addrgenmode { eui64 | none | stable_secret | random } ]\n");
@@ -356,6 +357,18 @@ static int iplink_parse_vf(int vf, int *argcp, char ***argvp,
                        ivs.vf = vf;
                        addattr_l(&req->n, sizeof(*req), IFLA_VF_RSS_QUERY_EN, &ivs, sizeof(ivs));
 
+               } else if (matches(*argv, "trust") == 0) {
+                       struct ifla_vf_trust ivt;
+                       NEXT_ARG();
+                       if (matches(*argv, "on") == 0)
+                               ivt.setting = 1;
+                       else if (matches(*argv, "off") == 0)
+                               ivt.setting = 0;
+                       else
+                               invarg("Invalid \"trust\" value\n", *argv);
+                       ivt.vf = vf;
+                       addattr_l(&req->n, sizeof(*req), IFLA_VF_TRUST, &ivt, sizeof(ivt));
+
                } else if (matches(*argv, "state") == 0) {
                        struct ifla_vf_link_state ivl;
 
index 4d3234352004e2300dd66e96e3618d08445e7b93..221831e52bc9a7618c4a547ab3dd2aeb62fceb1b 100644 (file)
@@ -142,7 +142,8 @@ ip-link \- network device configuration
 .B min_tx_rate
 .IR TXRATE " ] ["
 .B spoofchk { on | off } ] [
-.B state { auto | enable | disable}
+.B state { auto | enable | disable} ] [
+.B trust { on | off }
 ] |
 .br
 .B master
@@ -1019,6 +1020,10 @@ parameter must be specified.
 reflection of the PF link state, enable lets the VF to communicate with other VFs on
 this host even if the PF link state is down, disable causes the HW to drop any packets
 sent by the VF.
+.sp
+.BI trust " on|off"
+- trust the specified VF user. This enables that VF user can set a specific feature
+which may impact security and/or performance. (e.g. VF multicast promiscuous mode)
 .in -8
 
 .TP