Add VF link state control
Add link state per VF command
Signed-off-by: Rony Efraim <ronye@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 5b9a438..d2524e8 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -229,6 +229,7 @@
struct ifla_vf_vlan *vf_vlan;
struct ifla_vf_tx_rate *vf_tx_rate;
struct ifla_vf_spoofchk *vf_spoofchk;
+ struct ifla_vf_link_state *vf_linkstate;
struct rtattr *vf[IFLA_VF_MAX+1];
struct rtattr *tmp;
SPRINT_BUF(b1);
@@ -255,6 +256,20 @@
else
vf_spoofchk = RTA_DATA(vf[IFLA_VF_SPOOFCHK]);
+ if (vf_spoofchk) {
+ /* Check if the link state vf info type is supported by
+ * this kernel.
+ */
+ tmp = (struct rtattr *)((char *)vf[IFLA_VF_SPOOFCHK] +
+ vf[IFLA_VF_SPOOFCHK]->rta_len);
+
+ if (tmp->rta_type != IFLA_VF_LINK_STATE)
+ vf_linkstate = NULL;
+ else
+ vf_linkstate = RTA_DATA(vf[IFLA_VF_LINK_STATE]);
+ } else
+ vf_linkstate = NULL;
+
fprintf(fp, "\n vf %d MAC %s", vf_mac->vf,
ll_addr_n2a((unsigned char *)&vf_mac->mac,
ETH_ALEN, 0, b1, sizeof(b1)));
@@ -270,6 +285,14 @@
else
fprintf(fp, ", spoof checking off");
}
+ if (vf_linkstate) {
+ if (vf_linkstate->link_state == IFLA_VF_LINK_STATE_AUTO)
+ fprintf(fp, ", link-state auto");
+ else if (vf_linkstate->link_state == IFLA_VF_LINK_STATE_ENABLE)
+ fprintf(fp, ", link-state enable");
+ else
+ fprintf(fp, ", link-state disable");
+ }
}
static void print_link_stats64(FILE *fp, const struct rtnl_link_stats64 *s) {