ipoib: correcly show a VF hardware address
Subsystems (3)
PATCH 1/2 ipoib: correcly show a VF hardware address
in the case of IPoIB with SRIOV enabled hardware
ip link show command incorrecly prints
0 instead of a VF hardware address.
Before:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 MAC 00:00:00:00:00:00, spoof checking off, link-state disable,
trust off, query_rss off
...
After:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof checking off, link-state disable, trust off, query_rss off
v1->v2: just copy an address without modifing ifla_vf_mac v2->v3: update the changelog
--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/ipoib/ipoib_main.c +1 -0
@@ -1998,6 +1998,7 @@ static int ipoib_get_vf_config(struct net_device *dev, int vf,return err; ivf->vf = vf; +memcpy (ivf->mac, dev->dev_addr, dev->addr_len);return 0 ; }
Signature · 1 line
2.12.3
PATCH 2/2 ipoib: show VF broadcast address
in IPoIB case we can't see a VF broadcast address for but can see for PF
Before:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 MAC 14:80:00:00:66:fe, spoof checking off, link-state disable,
trust off, query_rss off
...
After:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof checking off, link-state disable, trust off, query_rss off
v1->v2: add the IFLA_VF_BROADCAST constantv2->v3: put IFLA_VF_BROADCAST at the end
to avoid KABI breakage and set NLA_REJECTdev_setlink
--- include/uapi/linux/if_link.h | 5 +++++ net/core/rtnetlink.c | 5 +++++ 2 files changed, 10 insertions(+)
include/uapi/linux/if_link.h +5 -0
@@ -694,6 +694,7 @@ enum {IFLA_VF_IB_NODE_GUID ,/* VF Infiniband node GUID */ IFLA_VF_IB_PORT_GUID ,/* VF Infiniband port GUID */ IFLA_VF_VLAN_LIST ,/* nested list of vlans, option for QinQ */ +IFLA_VF_BROADCAST ,/* VF broadcast */ __IFLA_VF_MAX, };
@@ -704,6 +705,10 @@ struct ifla_vf_mac {__u8 mac[32 ];/* MAX_ADDR_LEN */ }; +struct ifla_vf_broadcast { +__u8 broadcast[32 ]; +}; +struct ifla_vf_vlan {__u32 vf;__u32 vlan;/* 0 - 4095, 0 disables VLAN filter */
net/core/rtnetlink.c +5 -0
@@ -908,6 +908,7 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev, size += num_vfs * (nla_total_size (0 ) +nla_total_size (sizeof (struct ifla_vf_mac )) + +nla_total_size (sizeof (struct ifla_vf_broadcast )) +nla_total_size (sizeof (struct ifla_vf_vlan )) +nla_total_size (0 ) +/* nest IFLA_VF_VLAN_LIST */ nla_total_size(MAX_VLAN_LIST_LEN *
@@ -1197,6 +1198,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,struct ifla_vf_vlan vf_vlan;struct ifla_vf_rate vf_rate;struct ifla_vf_mac vf_mac; +struct ifla_vf_broadcast vf_broadcast;struct ifla_vf_info ivi;memset (&ivi,0 ,sizeof (ivi));
@@ -1231,6 +1233,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, vf_trust.vf = ivi.vf;memcpy (vf_mac.mac, ivi.mac,sizeof (ivi.mac)); +memcpy (vf_broadcast.broadcast, dev->broadcast, dev->addr_len); vf_vlan.vlan = ivi.vlan; vf_vlan.qos = ivi.qos; vf_vlan_info.vlan = ivi.vlan;
@@ -1247,6 +1250,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,if (!vf) goto nla_put_vfinfo_failure; if (nla_put(skb, IFLA_VF_MAC, sizeof(vf_mac), &vf_mac) || + nla_put(skb, IFLA_VF_BROADCAST, sizeof(vf_broadcast), &vf_broadcast) || nla_put(skb, IFLA_VF_VLAN, sizeof(vf_vlan), &vf_vlan) || nla_put(skb, IFLA_VF_RATE, sizeof(vf_rate), &vf_rate) ||
@@ -1753,6 +1757,7 @@ static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX +1 ] = { [IFLA_VF_MAC ] = { .len =sizeof (struct ifla_vf_mac ) }, + [IFLA_VF_BROADCAST ] = { .type =NLA_REJECT }, [IFLA_VF_VLAN ] = { .len =sizeof (struct ifla_vf_vlan ) }, [IFLA_VF_VLAN_LIST ] = { .type =NLA_NESTED }, [IFLA_VF_TX_RATE ] = { .len =sizeof (struct ifla_vf_tx_rate ) },
Signature · 1 line
2.12.3
Re: [PATCH 2/2] ipoib: show VF broadcast address
Quoted 9 lines · Denis Kirjanov
in IPoIB case we can't see a VF broadcast address for but can see for PF
Before:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdiscpfifo_faststate UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
Quoted 4 lines
vf 0 MAC 14:80:00:00:66:fe, spoof checking off, link-statedisable,
trust off,query_rssoff
...
The above Before: output should be used as the After: portion of the previous commit message. The previos commit does not fully resolve the problem, but yet the commit message acts as though it does.
Quoted 11 lines
After:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdiscpfifo_faststate UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof checking off, link-state disable, trust off,query_rssoff
Ok, I get why the After: should have a valid broadcast. What I don't get is why the Before: shows a MAC and the After: shows a link/infiniband? What change in this patch is responsible for that difference? I honestly expect, by reading this patch, that you would have a MAC and Broadcast that look like Ethernet, not that the full issue would be resolved.
Quoted 90 lines
v1->v2: add theIFLA_VF_BROADCASTconstantv2->v3: putIFLA_VF_BROADCASTat the end
to avoid KABI breakage and setNLA_REJECTdev_setlinkSigned-off-by Denis Kirjanov <[email protected]>--- include/uapi/linux/if_link.h | 5 +++++ net/core/rtnetlink.c | 5 +++++ 2 files changed, 10 insertions(+)include/uapi/linux/if_link.h +0
-0@@ -694,6 +694,7 @@ enum {IFLA_VF_IB_NODE_GUID ,/* VF Infiniband node GUID */ IFLA_VF_IB_PORT_GUID ,/* VF Infiniband port GUID */ IFLA_VF_VLAN_LIST, /* nested list of vlans, option forQinQ */
include/uapi/linux/if_link.h +5
-0+IFLA_VF_BROADCAST ,/* VF broadcast */ __IFLA_VF_MAX, };@@ -704,6 +705,10 @@ struct ifla_vf_mac {__u8 mac[32 ];/* MAX_ADDR_LEN */ }; +struct ifla_vf_broadcast { +__u8 broadcast[32 ]; +}; +struct ifla_vf_vlan {__u32 vf;__u32 vlan;/* 0 - 4095, 0 disables VLAN filter */ net/core/rtnetlink.c +1
-0@@ -908,6 +908,7 @@ static inline int rtnl_vfinfo_size(const structnet_device *dev, size += num_vfs * (nla_total_size(0) + nla_total_size(sizeof(struct ifla_vf_mac)) + + nla_total_size(sizeof(struct
ifla_vf_broadcast)) +net/core/rtnetlink.c +0
-0nla_total_size (sizeof (struct ifla_vf_vlan )) +nla_total_size (0 ) +/* nest IFLA_VF_VLAN_LIST */
net/core/rtnetlink.c +1
-0nla_total_size(MAX_VLAN_LIST_LEN *@@ -1197,6 +1198,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, struct ifla_vf_vlan vf_vlan;struct ifla_vf_rate vf_rate;struct ifla_vf_mac vf_mac; +struct ifla_vf_broadcast vf_broadcast;struct ifla_vf_info ivi;net/core/rtnetlink.c +1
-0memset (&ivi,0 ,sizeof (ivi));@@ -1231,6 +1233,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, vf_trust.vf = ivi.vf;memcpy (vf_mac.mac, ivi.mac,sizeof (ivi.mac)); +memcpy (vf_broadcast.broadcast, dev->broadcast, dev->addr_len); vf_vlan.vlan = ivi.vlan; vf_vlan.qos = ivi.qos;net/core/rtnetlink.c +1
-0vf_vlan_info.vlan = ivi.vlan;@@ -1247,6 +1250,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, if (!vf) goto nla_put_vfinfo_failure;if (nla_put (skb,IFLA_VF_MAC ,sizeof (vf_mac), &vf_mac) || + nla_put(skb, IFLA_VF_BROADCAST, sizeof(vf_broadcast),
&vf_broadcast) ||net/core/rtnetlink.c +1
-0nla_put (skb,IFLA_VF_VLAN ,sizeof (vf_vlan), &vf_vlan) ||nla_put (skb,IFLA_VF_RATE ,sizeof (vf_rate), &vf_rate) ||@@ -1753,6 +1757,7 @@ static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) }, + [IFLA_VF_BROADCAST] = { .type = NLA_REJECT }, [IFLA_VF_VLAN] = { .len = sizeof(struct
ifla_vf_vlan) },net/core/rtnetlink.c +0
-0[IFLA_VF_VLAN_LIST] = { .type = NLA_NESTED }, [IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate) },
Signature · 4 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
Re: [PATCH 2/2] ipoib: show VF broadcast address
Quoted 31 lines · Doug Ledford
Quoted 9 lines · Denis Kirjanov
in IPoIB case we can't see a VF broadcast address for but can see for PF
Before:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdiscpfifo_faststate UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ffQuoted 4 lines
vf 0 MAC 14:80:00:00:66:fe, spoof checking off, link-statedisable,
trust off,query_rssoff
...The above Before: output should be used as the After: portion of the previous commit message. The previos commit does not fully resolve the problem, but yet the commit message acts as though it does.
Quoted 11 lines
After:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdiscpfifo_faststate UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof checking off, link-state disable, trust off,query_rssoff
Quoted 6 lines
Ok, I get why the After: should have a valid broadcast. What I don't get is why the Before: shows a MAC and the After: shows a link/infiniband? What change in this patch is responsible for that difference? I honestly expect, by reading this patch, that you would have a MAC and Broadcast that look like Ethernet, not that the full issue would be resolved.
Hi Doug,
it's the patch for iproute2 that I'm going to send
Quoted 98 lines
Quoted 89 lines
v1->v2: add theIFLA_VF_BROADCASTconstantv2->v3: putIFLA_VF_BROADCASTat the end
to avoid KABI breakage and setNLA_REJECTdev_setlinkSigned-off-by Denis Kirjanov <[email protected]>--- include/uapi/linux/if_link.h | 5 +++++ net/core/rtnetlink.c | 5 +++++ 2 files changed, 10 insertions(+)include/uapi/linux/if_link.h +0
-0@@ -694,6 +694,7 @@ enum {IFLA_VF_IB_NODE_GUID ,/* VF Infiniband node GUID */ IFLA_VF_IB_PORT_GUID ,/* VF Infiniband port GUID */ IFLA_VF_VLAN_LIST, /* nested list of vlans, option forQinQ */
include/uapi/linux/if_link.h +5
-0+IFLA_VF_BROADCAST ,/* VF broadcast */ __IFLA_VF_MAX, };@@ -704,6 +705,10 @@ struct ifla_vf_mac {__u8 mac[32 ];/* MAX_ADDR_LEN */ }; +struct ifla_vf_broadcast { +__u8 broadcast[32 ]; +}; +struct ifla_vf_vlan {__u32 vf;__u32 vlan;/* 0 - 4095, 0 disables VLAN filter */ net/core/rtnetlink.c +1
-0@@ -908,6 +908,7 @@ static inline int rtnl_vfinfo_size(const structnet_device *dev, size += num_vfs * (nla_total_size(0) + nla_total_size(sizeof(struct ifla_vf_mac)) + + nla_total_size(sizeof(struct
ifla_vf_broadcast)) +net/core/rtnetlink.c +0
-0nla_total_size (sizeof (struct ifla_vf_vlan )) +nla_total_size (0 ) +/* nest IFLA_VF_VLAN_LIST */
net/core/rtnetlink.c +1
-0nla_total_size(MAX_VLAN_LIST_LEN *@@ -1197,6 +1198,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, struct ifla_vf_vlan vf_vlan;struct ifla_vf_rate vf_rate;struct ifla_vf_mac vf_mac; +struct ifla_vf_broadcast vf_broadcast;struct ifla_vf_info ivi;net/core/rtnetlink.c +1
-0memset (&ivi,0 ,sizeof (ivi));@@ -1231,6 +1233,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, vf_trust.vf = ivi.vf;memcpy (vf_mac.mac, ivi.mac,sizeof (ivi.mac)); +memcpy (vf_broadcast.broadcast, dev->broadcast, dev->addr_len); vf_vlan.vlan = ivi.vlan; vf_vlan.qos = ivi.qos;net/core/rtnetlink.c +1
-0vf_vlan_info.vlan = ivi.vlan;@@ -1247,6 +1250,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, if (!vf) goto nla_put_vfinfo_failure;if (nla_put (skb,IFLA_VF_MAC ,sizeof (vf_mac), &vf_mac) || + nla_put(skb, IFLA_VF_BROADCAST, sizeof(vf_broadcast),
&vf_broadcast) ||net/core/rtnetlink.c +1
-0nla_put (skb,IFLA_VF_VLAN ,sizeof (vf_vlan), &vf_vlan) ||nla_put (skb,IFLA_VF_RATE ,sizeof (vf_rate), &vf_rate) ||@@ -1753,6 +1757,7 @@ static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) }, + [IFLA_VF_BROADCAST] = { .type = NLA_REJECT }, [IFLA_VF_VLAN] = { .len = sizeof(struct
ifla_vf_vlan) },net/core/rtnetlink.c static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { · line 1763
Quoted 2 lines
net/core/rtnetlink.c +0
-0[IFLA_VF_VLAN_LIST] = { .type = NLA_NESTED }, [IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate) },--
Doug Ledford <[email protected]>GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E572FDD
Signature · 2 lines
Regards / Mit besten Grüßen, Denis
Re: [PATCH 2/2] ipoib: show VF broadcast address
Quoted 45 lines · Denis Kirjanov
Quoted 35 lines · Doug Ledford
Quoted 10 lines · Denis Kirjanov
in IPoIB case we can't see a VF broadcast address for but can see for PF
Before:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdiscpfifo_fast
state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ffQuoted 4 lines
vf 0 MAC 14:80:00:00:66:fe, spoof checking off, link-statedisable,
trust off,query_rssoff
...The above Before: output should be used as the After: portion of the
previous commit message. The previos commit does not fully resolve the
problem, but yet the commit message acts as though it does.Quoted 4 lines
After:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdiscpfifo_fast
state UP mode DEFAULT group default qlen 256Quoted 8 lines
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof
checking off, link-state disable, trust off,query_rssoffQuoted 8 lines
Ok, I get why the After: should have a valid broadcast. What I don't
get is why the Before: shows a MAC and the After: shows a link/infiniband? What change in this patch is responsible for that difference? I honestly expect, by reading this patch, that you would
have a MAC and Broadcast that look like Ethernet, not that the full issue would be resolved.
Quoted 2 lines
Hi Doug,
it's the patch for iproute2 that I'm going to send
Ahh, ok, then please mention that in the commit message or else the commit message and the patch won't quite make sense together. Maybe do a before: and after: without the iproute2 patch, then a after-with-
userspace-fix: that is the final result and mention the fix to iproute2 to print out the right link layer and size of address/broadcast.
Quoted 101 lines
Quoted 99 lines
Quoted 91 lines
v1->v2: add theIFLA_VF_BROADCASTconstantv2->v3: putIFLA_VF_BROADCASTat the end
to avoid KABI breakage and setNLA_REJECTdev_setlinkSigned-off-by Denis Kirjanov <[email protected]>--- include/uapi/linux/if_link.h | 5 +++++ net/core/rtnetlink.c | 5 +++++ 2 files changed, 10 insertions(+)include/uapi/linux/if_link.h +0
-0@@ -694,6 +694,7 @@ enum {IFLA_VF_IB_NODE_GUID ,/* VF Infiniband node GUID */ IFLA_VF_IB_PORT_GUID ,/* VF Infiniband port GUID */ IFLA_VF_VLAN_LIST, /* nested list of vlans, option forQinQ */
include/uapi/linux/if_link.h +5
-0+IFLA_VF_BROADCAST ,/* VF broadcast */ __IFLA_VF_MAX, };@@ -704,6 +705,10 @@ struct ifla_vf_mac {__u8 mac[32 ];/* MAX_ADDR_LEN */ }; +struct ifla_vf_broadcast { +__u8 broadcast[32 ]; +}; +struct ifla_vf_vlan {__u32 vf;__u32 vlan;/* 0 - 4095, 0 disables VLAN filter */ net/core/rtnetlink.c +0
-0@@ -908,6 +908,7 @@ static inline int rtnl_vfinfo_size(conststruct
net_device*dev,net/core/rtnetlink.c +1
-0size += num_vfs * (nla_total_size (0 ) +nla_total_size (sizeof (struct ifla_vf_mac )) + + nla_total_size(sizeof(struct
ifla_vf_broadcast)) +net/core/rtnetlink.c +0
-0nla_total_size (sizeof (struct ifla_vf_vlan )) +nla_total_size (0 ) +/* nest IFLA_VF_VLAN_LIST */
net/core/rtnetlink.c +1
-0nla_total_size(MAX_VLAN_LIST_LEN *@@ -1197,6 +1198,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, struct ifla_vf_vlan vf_vlan;struct ifla_vf_rate vf_rate;struct ifla_vf_mac vf_mac; +struct ifla_vf_broadcast vf_broadcast;struct ifla_vf_info ivi;net/core/rtnetlink.c +1
-0memset (&ivi,0 ,sizeof (ivi));@@ -1231,6 +1233,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, vf_trust.vf = ivi.vf;memcpy (vf_mac.mac, ivi.mac,sizeof (ivi.mac)); +memcpy (vf_broadcast.broadcast, dev->broadcast, dev->addr_len); vf_vlan.vlan = ivi.vlan; vf_vlan.qos = ivi.qos;net/core/rtnetlink.c +1
-0vf_vlan_info.vlan = ivi.vlan;@@ -1247,6 +1250,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, if (!vf) goto nla_put_vfinfo_failure;if (nla_put (skb,IFLA_VF_MAC ,sizeof (vf_mac), &vf_mac) || + nla_put(skb, IFLA_VF_BROADCAST, sizeof(vf_broadcast),
&vf_broadcast) ||net/core/rtnetlink.c +1
-0nla_put (skb,IFLA_VF_VLAN ,sizeof (vf_vlan), &vf_vlan) ||nla_put (skb,IFLA_VF_RATE ,sizeof (vf_rate), &vf_rate) ||@@ -1753,6 +1757,7 @@ static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) }, + [IFLA_VF_BROADCAST] = { .type = NLA_REJECT }, [IFLA_VF_VLAN] = { .len = sizeof(struct
ifla_vf_vlan) },net/core/rtnetlink.c +0
-0[IFLA_VF_VLAN_LIST] = { .type = NLA_NESTED }, [IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate)Quoted 1 line
},
--
Doug Ledford <[email protected]>GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E572FDD
Signature · 4 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
PATCH v3 1/2 ipoib: correcly show a VF hardware address
In reply to Denis Kirjanovin the case of IPoIB with SRIOV enabled hardware
ip link show command incorrecly prints
0 instead of a VF hardware address.
Before:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 MAC 00:00:00:00:00:00, spoof checking off, link-state disable,
trust off, query_rss off
...
After:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof checking off, link-state disable, trust off, query_rss off
v1->v2: just copy an address without modifing ifla_vf_mac v2->v3: update the changelog
--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/ipoib/ipoib_main.c +1 -0
@@ -1998,6 +1998,7 @@ static int ipoib_get_vf_config(struct net_device *dev, int vf,return err; ivf->vf = vf; +memcpy (ivf->mac, dev->dev_addr, dev->addr_len);return 0 ; }
Signature · 1 line
2.12.3
PATCH v3 2/2 ipoib: show VF broadcast address
In reply to Denis Kirjanovin IPoIB case we can't see a VF broadcast address for but can see for PF
Before:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 MAC 14:80:00:00:66:fe, spoof checking off, link-state disable,
trust off, query_rss off
...
After:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof checking off, link-state disable, trust off, query_rss off
v1->v2: add the IFLA_VF_BROADCAST constantv2->v3: put IFLA_VF_BROADCAST at the end
to avoid KABI breakage and set NLA_REJECTdev_setlink
--- include/uapi/linux/if_link.h | 5 +++++ net/core/rtnetlink.c | 5 +++++ 2 files changed, 10 insertions(+)
include/uapi/linux/if_link.h +5 -0
@@ -694,6 +694,7 @@ enum {IFLA_VF_IB_NODE_GUID ,/* VF Infiniband node GUID */ IFLA_VF_IB_PORT_GUID ,/* VF Infiniband port GUID */ IFLA_VF_VLAN_LIST ,/* nested list of vlans, option for QinQ */ +IFLA_VF_BROADCAST ,/* VF broadcast */ __IFLA_VF_MAX, };
@@ -704,6 +705,10 @@ struct ifla_vf_mac {__u8 mac[32 ];/* MAX_ADDR_LEN */ }; +struct ifla_vf_broadcast { +__u8 broadcast[32 ]; +}; +struct ifla_vf_vlan {__u32 vf;__u32 vlan;/* 0 - 4095, 0 disables VLAN filter */
net/core/rtnetlink.c +5 -0
@@ -908,6 +908,7 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev, size += num_vfs * (nla_total_size (0 ) +nla_total_size (sizeof (struct ifla_vf_mac )) + +nla_total_size (sizeof (struct ifla_vf_broadcast )) +nla_total_size (sizeof (struct ifla_vf_vlan )) +nla_total_size (0 ) +/* nest IFLA_VF_VLAN_LIST */ nla_total_size(MAX_VLAN_LIST_LEN *
@@ -1197,6 +1198,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,struct ifla_vf_vlan vf_vlan;struct ifla_vf_rate vf_rate;struct ifla_vf_mac vf_mac; +struct ifla_vf_broadcast vf_broadcast;struct ifla_vf_info ivi;memset (&ivi,0 ,sizeof (ivi));
@@ -1231,6 +1233,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, vf_trust.vf = ivi.vf;memcpy (vf_mac.mac, ivi.mac,sizeof (ivi.mac)); +memcpy (vf_broadcast.broadcast, dev->broadcast, dev->addr_len); vf_vlan.vlan = ivi.vlan; vf_vlan.qos = ivi.qos; vf_vlan_info.vlan = ivi.vlan;
@@ -1247,6 +1250,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,if (!vf) goto nla_put_vfinfo_failure; if (nla_put(skb, IFLA_VF_MAC, sizeof(vf_mac), &vf_mac) || + nla_put(skb, IFLA_VF_BROADCAST, sizeof(vf_broadcast), &vf_broadcast) || nla_put(skb, IFLA_VF_VLAN, sizeof(vf_vlan), &vf_vlan) || nla_put(skb, IFLA_VF_RATE, sizeof(vf_rate), &vf_rate) ||
@@ -1753,6 +1757,7 @@ static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX +1 ] = { [IFLA_VF_MAC ] = { .len =sizeof (struct ifla_vf_mac ) }, + [IFLA_VF_BROADCAST ] = { .type =NLA_REJECT }, [IFLA_VF_VLAN ] = { .len =sizeof (struct ifla_vf_vlan ) }, [IFLA_VF_VLAN_LIST ] = { .type =NLA_NESTED }, [IFLA_VF_TX_RATE ] = { .len =sizeof (struct ifla_vf_tx_rate ) },
Signature · 1 line
2.12.3