Message ID | 1368020717-22194-2-git-send-email-ogerlitz@mellanox.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
Hello. On 08-05-2013 17:45, Or Gerlitz wrote: > From: Rony Efraim <ronye@mellanox.com> > Auto - the VF link state will reflect the PF link state > > Enable - VF link stat will be always up, traffic from VF to VF can > work even if PF link is down. > > Disable - VF link state is down and the VF can't send/recv, e.g can be > used to suspend the link while configuring the VF. > Signed-off-by: Rony Efraim <ronye@mellanox.com> [...] > diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c > index a08bd2b..bec44a3 100644 > --- a/net/core/rtnetlink.c > +++ b/net/core/rtnetlink.c > @@ -1238,6 +1238,15 @@ static int do_setvfinfo(struct net_device *dev, struct nlattr *attr) > ivs->setting); > break; > } > + case IFLA_VF_LINK_STATE: { > + struct ifla_vf_link_state *ivl; > + ivl = nla_data(vf); Why not make it initializer? And empty line is needed between the declaration and other code. WBR, Sergei -- 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
On 08/05/2013 19:02, Sergei Shtylyov wrote: >> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c >> index a08bd2b..bec44a3 100644 >> --- a/net/core/rtnetlink.c >> +++ b/net/core/rtnetlink.c >> @@ -1238,6 +1238,15 @@ static int do_setvfinfo(struct net_device >> *dev, struct nlattr *attr) >> ivs->setting); >> break; >> } >> + case IFLA_VF_LINK_STATE: { >> + struct ifla_vf_link_state *ivl; >> + ivl = nla_data(vf); > > Why not make it initializer? And empty line is needed between the > declaration and other code. b/c we followed the conventions introduced in the preceding cases of do_setvfinfo which we found to be OK -- 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
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index f8898a4..e609474 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -801,6 +801,7 @@ struct netdev_fcoe_hbainfo { * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); * int (*ndo_get_vf_config)(struct net_device *dev, * int vf, struct ifla_vf_info *ivf); + * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state); * int (*ndo_set_vf_port)(struct net_device *dev, int vf, * struct nlattr *port[]); * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); @@ -955,6 +956,8 @@ struct net_device_ops { int (*ndo_get_vf_config)(struct net_device *dev, int vf, struct ifla_vf_info *ivf); + int (*ndo_set_vf_link_state)(struct net_device *dev, + int vf, int link_state); int (*ndo_set_vf_port)(struct net_device *dev, int vf, struct nlattr *port[]); diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index b05823c..a923efd 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -336,6 +336,7 @@ enum { IFLA_VF_VLAN, IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */ IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */ + IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */ __IFLA_VF_MAX, }; @@ -362,6 +363,18 @@ struct ifla_vf_spoofchk { __u32 setting; }; +enum { + IFLA_VF_LINK_STATE_AUTO, /* link state of the uplink */ + IFLA_VF_LINK_STATE_ENABLE, /* link always up */ + IFLA_VF_LINK_STATE_DISABLE, /* link always down */ + __IFLA_VF_LINK_STATE_MAX, +}; + +struct ifla_vf_link_state { + __u32 vf; + __u32 link_state; +}; + /* VF ports management section * * Nested layout of set/get msg is: diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index a08bd2b..bec44a3 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1238,6 +1238,15 @@ static int do_setvfinfo(struct net_device *dev, struct nlattr *attr) ivs->setting); break; } + case IFLA_VF_LINK_STATE: { + struct ifla_vf_link_state *ivl; + ivl = nla_data(vf); + err = -EOPNOTSUPP; + if (ops->ndo_set_vf_link_state) + err = ops->ndo_set_vf_link_state(dev, ivl->vf, + ivl->link_state); + break; + } default: err = -EINVAL; break;