rtnetlink.c (53c8b29abe42e5601cfa0ea5962532f0cfdec8a0) | rtnetlink.c (c22a133a83ce64949dc35156eaefeda5a1e12bc3) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * INET An implementation of the TCP/IP protocol suite for the LINUX 4 * operating system. INET is implemented using the BSD Socket 5 * interface as the means of communication with the user level. 6 * 7 * Routing netlink socket interface: protocol independent part. 8 * --- 737 unchanged lines hidden (view full) --- 746} 747EXPORT_SYMBOL(rtnl_set_sk_err); 748 749int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics) 750{ 751 struct nlattr *mx; 752 int i, valid = 0; 753 | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * INET An implementation of the TCP/IP protocol suite for the LINUX 4 * operating system. INET is implemented using the BSD Socket 5 * interface as the means of communication with the user level. 6 * 7 * Routing netlink socket interface: protocol independent part. 8 * --- 737 unchanged lines hidden (view full) --- 746} 747EXPORT_SYMBOL(rtnl_set_sk_err); 748 749int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics) 750{ 751 struct nlattr *mx; 752 int i, valid = 0; 753 |
754 /* nothing is dumped for dst_default_metrics, so just skip the loop */ 755 if (metrics == dst_default_metrics.metrics) 756 return 0; 757 |
|
754 mx = nla_nest_start_noflag(skb, RTA_METRICS); 755 if (mx == NULL) 756 return -ENOBUFS; 757 758 for (i = 0; i < RTAX_MAX; i++) { 759 if (metrics[i]) { 760 if (i == RTAX_CC_ALGO - 1) { 761 char tmp[TCP_CA_NAME_MAX], *name; --- 141 unchanged lines hidden (view full) --- 903 u32 ext_filter_mask) 904{ 905 if (dev->dev.parent && (ext_filter_mask & RTEXT_FILTER_VF)) { 906 int num_vfs = dev_num_vf(dev->dev.parent); 907 size_t size = nla_total_size(0); 908 size += num_vfs * 909 (nla_total_size(0) + 910 nla_total_size(sizeof(struct ifla_vf_mac)) + | 758 mx = nla_nest_start_noflag(skb, RTA_METRICS); 759 if (mx == NULL) 760 return -ENOBUFS; 761 762 for (i = 0; i < RTAX_MAX; i++) { 763 if (metrics[i]) { 764 if (i == RTAX_CC_ALGO - 1) { 765 char tmp[TCP_CA_NAME_MAX], *name; --- 141 unchanged lines hidden (view full) --- 907 u32 ext_filter_mask) 908{ 909 if (dev->dev.parent && (ext_filter_mask & RTEXT_FILTER_VF)) { 910 int num_vfs = dev_num_vf(dev->dev.parent); 911 size_t size = nla_total_size(0); 912 size += num_vfs * 913 (nla_total_size(0) + 914 nla_total_size(sizeof(struct ifla_vf_mac)) + |
915 nla_total_size(sizeof(struct ifla_vf_broadcast)) + |
|
911 nla_total_size(sizeof(struct ifla_vf_vlan)) + 912 nla_total_size(0) + /* nest IFLA_VF_VLAN_LIST */ 913 nla_total_size(MAX_VLAN_LIST_LEN * 914 sizeof(struct ifla_vf_vlan_info)) + 915 nla_total_size(sizeof(struct ifla_vf_spoofchk)) + 916 nla_total_size(sizeof(struct ifla_vf_tx_rate)) + 917 nla_total_size(sizeof(struct ifla_vf_rate)) + 918 nla_total_size(sizeof(struct ifla_vf_link_state)) + --- 273 unchanged lines hidden (view full) --- 1192 struct ifla_vf_vlan_info vf_vlan_info; 1193 struct ifla_vf_spoofchk vf_spoofchk; 1194 struct ifla_vf_tx_rate vf_tx_rate; 1195 struct ifla_vf_stats vf_stats; 1196 struct ifla_vf_trust vf_trust; 1197 struct ifla_vf_vlan vf_vlan; 1198 struct ifla_vf_rate vf_rate; 1199 struct ifla_vf_mac vf_mac; | 916 nla_total_size(sizeof(struct ifla_vf_vlan)) + 917 nla_total_size(0) + /* nest IFLA_VF_VLAN_LIST */ 918 nla_total_size(MAX_VLAN_LIST_LEN * 919 sizeof(struct ifla_vf_vlan_info)) + 920 nla_total_size(sizeof(struct ifla_vf_spoofchk)) + 921 nla_total_size(sizeof(struct ifla_vf_tx_rate)) + 922 nla_total_size(sizeof(struct ifla_vf_rate)) + 923 nla_total_size(sizeof(struct ifla_vf_link_state)) + --- 273 unchanged lines hidden (view full) --- 1197 struct ifla_vf_vlan_info vf_vlan_info; 1198 struct ifla_vf_spoofchk vf_spoofchk; 1199 struct ifla_vf_tx_rate vf_tx_rate; 1200 struct ifla_vf_stats vf_stats; 1201 struct ifla_vf_trust vf_trust; 1202 struct ifla_vf_vlan vf_vlan; 1203 struct ifla_vf_rate vf_rate; 1204 struct ifla_vf_mac vf_mac; |
1205 struct ifla_vf_broadcast vf_broadcast; |
|
1200 struct ifla_vf_info ivi; 1201 1202 memset(&ivi, 0, sizeof(ivi)); 1203 1204 /* Not all SR-IOV capable drivers support the 1205 * spoofcheck and "RSS query enable" query. Preset to 1206 * -1 so the user space tool can detect that the driver 1207 * didn't report anything. --- 18 unchanged lines hidden (view full) --- 1226 vf_rate.vf = 1227 vf_tx_rate.vf = 1228 vf_spoofchk.vf = 1229 vf_linkstate.vf = 1230 vf_rss_query_en.vf = 1231 vf_trust.vf = ivi.vf; 1232 1233 memcpy(vf_mac.mac, ivi.mac, sizeof(ivi.mac)); | 1206 struct ifla_vf_info ivi; 1207 1208 memset(&ivi, 0, sizeof(ivi)); 1209 1210 /* Not all SR-IOV capable drivers support the 1211 * spoofcheck and "RSS query enable" query. Preset to 1212 * -1 so the user space tool can detect that the driver 1213 * didn't report anything. --- 18 unchanged lines hidden (view full) --- 1232 vf_rate.vf = 1233 vf_tx_rate.vf = 1234 vf_spoofchk.vf = 1235 vf_linkstate.vf = 1236 vf_rss_query_en.vf = 1237 vf_trust.vf = ivi.vf; 1238 1239 memcpy(vf_mac.mac, ivi.mac, sizeof(ivi.mac)); |
1240 memcpy(vf_broadcast.broadcast, dev->broadcast, dev->addr_len); |
|
1234 vf_vlan.vlan = ivi.vlan; 1235 vf_vlan.qos = ivi.qos; 1236 vf_vlan_info.vlan = ivi.vlan; 1237 vf_vlan_info.qos = ivi.qos; 1238 vf_vlan_info.vlan_proto = ivi.vlan_proto; 1239 vf_tx_rate.rate = ivi.max_tx_rate; 1240 vf_rate.min_tx_rate = ivi.min_tx_rate; 1241 vf_rate.max_tx_rate = ivi.max_tx_rate; 1242 vf_spoofchk.setting = ivi.spoofchk; 1243 vf_linkstate.link_state = ivi.linkstate; 1244 vf_rss_query_en.setting = ivi.rss_query_en; 1245 vf_trust.setting = ivi.trusted; 1246 vf = nla_nest_start_noflag(skb, IFLA_VF_INFO); 1247 if (!vf) 1248 goto nla_put_vfinfo_failure; 1249 if (nla_put(skb, IFLA_VF_MAC, sizeof(vf_mac), &vf_mac) || | 1241 vf_vlan.vlan = ivi.vlan; 1242 vf_vlan.qos = ivi.qos; 1243 vf_vlan_info.vlan = ivi.vlan; 1244 vf_vlan_info.qos = ivi.qos; 1245 vf_vlan_info.vlan_proto = ivi.vlan_proto; 1246 vf_tx_rate.rate = ivi.max_tx_rate; 1247 vf_rate.min_tx_rate = ivi.min_tx_rate; 1248 vf_rate.max_tx_rate = ivi.max_tx_rate; 1249 vf_spoofchk.setting = ivi.spoofchk; 1250 vf_linkstate.link_state = ivi.linkstate; 1251 vf_rss_query_en.setting = ivi.rss_query_en; 1252 vf_trust.setting = ivi.trusted; 1253 vf = nla_nest_start_noflag(skb, IFLA_VF_INFO); 1254 if (!vf) 1255 goto nla_put_vfinfo_failure; 1256 if (nla_put(skb, IFLA_VF_MAC, sizeof(vf_mac), &vf_mac) || |
1257 nla_put(skb, IFLA_VF_BROADCAST, sizeof(vf_broadcast), &vf_broadcast) || |
|
1250 nla_put(skb, IFLA_VF_VLAN, sizeof(vf_vlan), &vf_vlan) || 1251 nla_put(skb, IFLA_VF_RATE, sizeof(vf_rate), 1252 &vf_rate) || 1253 nla_put(skb, IFLA_VF_TX_RATE, sizeof(vf_tx_rate), 1254 &vf_tx_rate) || 1255 nla_put(skb, IFLA_VF_SPOOFCHK, sizeof(vf_spoofchk), 1256 &vf_spoofchk) || 1257 nla_put(skb, IFLA_VF_LINK_STATE, sizeof(vf_linkstate), --- 490 unchanged lines hidden (view full) --- 1748 [IFLA_INFO_KIND] = { .type = NLA_STRING }, 1749 [IFLA_INFO_DATA] = { .type = NLA_NESTED }, 1750 [IFLA_INFO_SLAVE_KIND] = { .type = NLA_STRING }, 1751 [IFLA_INFO_SLAVE_DATA] = { .type = NLA_NESTED }, 1752}; 1753 1754static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { 1755 [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) }, | 1258 nla_put(skb, IFLA_VF_VLAN, sizeof(vf_vlan), &vf_vlan) || 1259 nla_put(skb, IFLA_VF_RATE, sizeof(vf_rate), 1260 &vf_rate) || 1261 nla_put(skb, IFLA_VF_TX_RATE, sizeof(vf_tx_rate), 1262 &vf_tx_rate) || 1263 nla_put(skb, IFLA_VF_SPOOFCHK, sizeof(vf_spoofchk), 1264 &vf_spoofchk) || 1265 nla_put(skb, IFLA_VF_LINK_STATE, sizeof(vf_linkstate), --- 490 unchanged lines hidden (view full) --- 1756 [IFLA_INFO_KIND] = { .type = NLA_STRING }, 1757 [IFLA_INFO_DATA] = { .type = NLA_NESTED }, 1758 [IFLA_INFO_SLAVE_KIND] = { .type = NLA_STRING }, 1759 [IFLA_INFO_SLAVE_DATA] = { .type = NLA_NESTED }, 1760}; 1761 1762static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { 1763 [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) }, |
1764 [IFLA_VF_BROADCAST] = { .type = NLA_REJECT }, |
|
1756 [IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) }, 1757 [IFLA_VF_VLAN_LIST] = { .type = NLA_NESTED }, 1758 [IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate) }, 1759 [IFLA_VF_SPOOFCHK] = { .len = sizeof(struct ifla_vf_spoofchk) }, 1760 [IFLA_VF_RATE] = { .len = sizeof(struct ifla_vf_rate) }, 1761 [IFLA_VF_LINK_STATE] = { .len = sizeof(struct ifla_vf_link_state) }, 1762 [IFLA_VF_RSS_QUERY_EN] = { .len = sizeof(struct ifla_vf_rss_query_en) }, 1763 [IFLA_VF_STATS] = { .type = NLA_NESTED }, --- 3572 unchanged lines hidden --- | 1765 [IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) }, 1766 [IFLA_VF_VLAN_LIST] = { .type = NLA_NESTED }, 1767 [IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate) }, 1768 [IFLA_VF_SPOOFCHK] = { .len = sizeof(struct ifla_vf_spoofchk) }, 1769 [IFLA_VF_RATE] = { .len = sizeof(struct ifla_vf_rate) }, 1770 [IFLA_VF_LINK_STATE] = { .len = sizeof(struct ifla_vf_link_state) }, 1771 [IFLA_VF_RSS_QUERY_EN] = { .len = sizeof(struct ifla_vf_rss_query_en) }, 1772 [IFLA_VF_STATS] = { .type = NLA_NESTED }, --- 3572 unchanged lines hidden --- |