rtnetlink.c (cbfef53360ea88fa7ef9f80def778fba9b05d21e) | rtnetlink.c (ed616689a3d95eb6c9bdbb1ef74b0f50cbdf276a) |
---|---|
1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 753 unchanged lines hidden (view full) --- 762 if (dev->dev.parent && dev_is_pci(dev->dev.parent) && 763 (ext_filter_mask & RTEXT_FILTER_VF)) { 764 int num_vfs = dev_num_vf(dev->dev.parent); 765 size_t size = nla_total_size(sizeof(struct nlattr)); 766 size += nla_total_size(num_vfs * sizeof(struct nlattr)); 767 size += num_vfs * 768 (nla_total_size(sizeof(struct ifla_vf_mac)) + 769 nla_total_size(sizeof(struct ifla_vf_vlan)) + | 1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 753 unchanged lines hidden (view full) --- 762 if (dev->dev.parent && dev_is_pci(dev->dev.parent) && 763 (ext_filter_mask & RTEXT_FILTER_VF)) { 764 int num_vfs = dev_num_vf(dev->dev.parent); 765 size_t size = nla_total_size(sizeof(struct nlattr)); 766 size += nla_total_size(num_vfs * sizeof(struct nlattr)); 767 size += num_vfs * 768 (nla_total_size(sizeof(struct ifla_vf_mac)) + 769 nla_total_size(sizeof(struct ifla_vf_vlan)) + |
770 nla_total_size(sizeof(struct ifla_vf_tx_rate)) + 771 nla_total_size(sizeof(struct ifla_vf_spoofchk))); | 770 nla_total_size(sizeof(struct ifla_vf_spoofchk)) + 771 nla_total_size(sizeof(struct ifla_vf_rate))); |
772 return size; 773 } else 774 return 0; 775} 776 777static size_t rtnl_port_size(const struct net_device *dev, 778 u32 ext_filter_mask) 779{ --- 249 unchanged lines hidden (view full) --- 1029 1030 vfinfo = nla_nest_start(skb, IFLA_VFINFO_LIST); 1031 if (!vfinfo) 1032 goto nla_put_failure; 1033 for (i = 0; i < num_vfs; i++) { 1034 struct ifla_vf_info ivi; 1035 struct ifla_vf_mac vf_mac; 1036 struct ifla_vf_vlan vf_vlan; | 772 return size; 773 } else 774 return 0; 775} 776 777static size_t rtnl_port_size(const struct net_device *dev, 778 u32 ext_filter_mask) 779{ --- 249 unchanged lines hidden (view full) --- 1029 1030 vfinfo = nla_nest_start(skb, IFLA_VFINFO_LIST); 1031 if (!vfinfo) 1032 goto nla_put_failure; 1033 for (i = 0; i < num_vfs; i++) { 1034 struct ifla_vf_info ivi; 1035 struct ifla_vf_mac vf_mac; 1036 struct ifla_vf_vlan vf_vlan; |
1037 struct ifla_vf_rate vf_rate; |
|
1037 struct ifla_vf_tx_rate vf_tx_rate; 1038 struct ifla_vf_spoofchk vf_spoofchk; 1039 struct ifla_vf_link_state vf_linkstate; 1040 1041 /* 1042 * Not all SR-IOV capable drivers support the 1043 * spoofcheck query. Preset to -1 so the user 1044 * space tool can detect that the driver didn't --- 4 unchanged lines hidden (view full) --- 1049 /* The default value for VF link state is "auto" 1050 * IFLA_VF_LINK_STATE_AUTO which equals zero 1051 */ 1052 ivi.linkstate = 0; 1053 if (dev->netdev_ops->ndo_get_vf_config(dev, i, &ivi)) 1054 break; 1055 vf_mac.vf = 1056 vf_vlan.vf = | 1038 struct ifla_vf_tx_rate vf_tx_rate; 1039 struct ifla_vf_spoofchk vf_spoofchk; 1040 struct ifla_vf_link_state vf_linkstate; 1041 1042 /* 1043 * Not all SR-IOV capable drivers support the 1044 * spoofcheck query. Preset to -1 so the user 1045 * space tool can detect that the driver didn't --- 4 unchanged lines hidden (view full) --- 1050 /* The default value for VF link state is "auto" 1051 * IFLA_VF_LINK_STATE_AUTO which equals zero 1052 */ 1053 ivi.linkstate = 0; 1054 if (dev->netdev_ops->ndo_get_vf_config(dev, i, &ivi)) 1055 break; 1056 vf_mac.vf = 1057 vf_vlan.vf = |
1058 vf_rate.vf = |
|
1057 vf_tx_rate.vf = 1058 vf_spoofchk.vf = 1059 vf_linkstate.vf = ivi.vf; 1060 1061 memcpy(vf_mac.mac, ivi.mac, sizeof(ivi.mac)); 1062 vf_vlan.vlan = ivi.vlan; 1063 vf_vlan.qos = ivi.qos; | 1059 vf_tx_rate.vf = 1060 vf_spoofchk.vf = 1061 vf_linkstate.vf = ivi.vf; 1062 1063 memcpy(vf_mac.mac, ivi.mac, sizeof(ivi.mac)); 1064 vf_vlan.vlan = ivi.vlan; 1065 vf_vlan.qos = ivi.qos; |
1064 vf_tx_rate.rate = ivi.tx_rate; | 1066 vf_tx_rate.rate = ivi.max_tx_rate; 1067 vf_rate.min_tx_rate = ivi.min_tx_rate; 1068 vf_rate.max_tx_rate = ivi.max_tx_rate; |
1065 vf_spoofchk.setting = ivi.spoofchk; 1066 vf_linkstate.link_state = ivi.linkstate; 1067 vf = nla_nest_start(skb, IFLA_VF_INFO); 1068 if (!vf) { 1069 nla_nest_cancel(skb, vfinfo); 1070 goto nla_put_failure; 1071 } 1072 if (nla_put(skb, IFLA_VF_MAC, sizeof(vf_mac), &vf_mac) || 1073 nla_put(skb, IFLA_VF_VLAN, sizeof(vf_vlan), &vf_vlan) || | 1069 vf_spoofchk.setting = ivi.spoofchk; 1070 vf_linkstate.link_state = ivi.linkstate; 1071 vf = nla_nest_start(skb, IFLA_VF_INFO); 1072 if (!vf) { 1073 nla_nest_cancel(skb, vfinfo); 1074 goto nla_put_failure; 1075 } 1076 if (nla_put(skb, IFLA_VF_MAC, sizeof(vf_mac), &vf_mac) || 1077 nla_put(skb, IFLA_VF_VLAN, sizeof(vf_vlan), &vf_vlan) || |
1078 nla_put(skb, IFLA_VF_RATE, sizeof(vf_rate), 1079 &vf_rate) || |
|
1074 nla_put(skb, IFLA_VF_TX_RATE, sizeof(vf_tx_rate), 1075 &vf_tx_rate) || 1076 nla_put(skb, IFLA_VF_SPOOFCHK, sizeof(vf_spoofchk), 1077 &vf_spoofchk) || 1078 nla_put(skb, IFLA_VF_LINK_STATE, sizeof(vf_linkstate), 1079 &vf_linkstate)) 1080 goto nla_put_failure; 1081 nla_nest_end(skb, vf); --- 90 unchanged lines hidden (view full) --- 1172 [IFLA_VF_MAC] = { .type = NLA_BINARY, 1173 .len = sizeof(struct ifla_vf_mac) }, 1174 [IFLA_VF_VLAN] = { .type = NLA_BINARY, 1175 .len = sizeof(struct ifla_vf_vlan) }, 1176 [IFLA_VF_TX_RATE] = { .type = NLA_BINARY, 1177 .len = sizeof(struct ifla_vf_tx_rate) }, 1178 [IFLA_VF_SPOOFCHK] = { .type = NLA_BINARY, 1179 .len = sizeof(struct ifla_vf_spoofchk) }, | 1080 nla_put(skb, IFLA_VF_TX_RATE, sizeof(vf_tx_rate), 1081 &vf_tx_rate) || 1082 nla_put(skb, IFLA_VF_SPOOFCHK, sizeof(vf_spoofchk), 1083 &vf_spoofchk) || 1084 nla_put(skb, IFLA_VF_LINK_STATE, sizeof(vf_linkstate), 1085 &vf_linkstate)) 1086 goto nla_put_failure; 1087 nla_nest_end(skb, vf); --- 90 unchanged lines hidden (view full) --- 1178 [IFLA_VF_MAC] = { .type = NLA_BINARY, 1179 .len = sizeof(struct ifla_vf_mac) }, 1180 [IFLA_VF_VLAN] = { .type = NLA_BINARY, 1181 .len = sizeof(struct ifla_vf_vlan) }, 1182 [IFLA_VF_TX_RATE] = { .type = NLA_BINARY, 1183 .len = sizeof(struct ifla_vf_tx_rate) }, 1184 [IFLA_VF_SPOOFCHK] = { .type = NLA_BINARY, 1185 .len = sizeof(struct ifla_vf_spoofchk) }, |
1186 [IFLA_VF_RATE] = { .type = NLA_BINARY, 1187 .len = sizeof(struct ifla_vf_rate) }, |
|
1180}; 1181 1182static const struct nla_policy ifla_port_policy[IFLA_PORT_MAX+1] = { 1183 [IFLA_PORT_VF] = { .type = NLA_U32 }, 1184 [IFLA_PORT_PROFILE] = { .type = NLA_STRING, 1185 .len = PORT_PROFILE_MAX }, 1186 [IFLA_PORT_VSI_TYPE] = { .type = NLA_BINARY, 1187 .len = sizeof(struct ifla_port_vsi)}, --- 143 unchanged lines hidden (view full) --- 1331 if (ops->ndo_set_vf_vlan) 1332 err = ops->ndo_set_vf_vlan(dev, ivv->vf, 1333 ivv->vlan, 1334 ivv->qos); 1335 break; 1336 } 1337 case IFLA_VF_TX_RATE: { 1338 struct ifla_vf_tx_rate *ivt; | 1188}; 1189 1190static const struct nla_policy ifla_port_policy[IFLA_PORT_MAX+1] = { 1191 [IFLA_PORT_VF] = { .type = NLA_U32 }, 1192 [IFLA_PORT_PROFILE] = { .type = NLA_STRING, 1193 .len = PORT_PROFILE_MAX }, 1194 [IFLA_PORT_VSI_TYPE] = { .type = NLA_BINARY, 1195 .len = sizeof(struct ifla_port_vsi)}, --- 143 unchanged lines hidden (view full) --- 1339 if (ops->ndo_set_vf_vlan) 1340 err = ops->ndo_set_vf_vlan(dev, ivv->vf, 1341 ivv->vlan, 1342 ivv->qos); 1343 break; 1344 } 1345 case IFLA_VF_TX_RATE: { 1346 struct ifla_vf_tx_rate *ivt; |
1347 struct ifla_vf_info ivf; |
|
1339 ivt = nla_data(vf); 1340 err = -EOPNOTSUPP; | 1348 ivt = nla_data(vf); 1349 err = -EOPNOTSUPP; |
1341 if (ops->ndo_set_vf_tx_rate) 1342 err = ops->ndo_set_vf_tx_rate(dev, ivt->vf, 1343 ivt->rate); | 1350 if (ops->ndo_get_vf_config) 1351 err = ops->ndo_get_vf_config(dev, ivt->vf, 1352 &ivf); 1353 if (err) 1354 break; 1355 err = -EOPNOTSUPP; 1356 if (ops->ndo_set_vf_rate) 1357 err = ops->ndo_set_vf_rate(dev, ivt->vf, 1358 ivf.min_tx_rate, 1359 ivt->rate); |
1344 break; 1345 } | 1360 break; 1361 } |
1362 case IFLA_VF_RATE: { 1363 struct ifla_vf_rate *ivt; 1364 ivt = nla_data(vf); 1365 err = -EOPNOTSUPP; 1366 if (ops->ndo_set_vf_rate) 1367 err = ops->ndo_set_vf_rate(dev, ivt->vf, 1368 ivt->min_tx_rate, 1369 ivt->max_tx_rate); 1370 break; 1371 } |
|
1346 case IFLA_VF_SPOOFCHK: { 1347 struct ifla_vf_spoofchk *ivs; 1348 ivs = nla_data(vf); 1349 err = -EOPNOTSUPP; 1350 if (ops->ndo_set_vf_spoofchk) 1351 err = ops->ndo_set_vf_spoofchk(dev, ivs->vf, 1352 ivs->setting); 1353 break; --- 1561 unchanged lines hidden --- | 1372 case IFLA_VF_SPOOFCHK: { 1373 struct ifla_vf_spoofchk *ivs; 1374 ivs = nla_data(vf); 1375 err = -EOPNOTSUPP; 1376 if (ops->ndo_set_vf_spoofchk) 1377 err = ops->ndo_set_vf_spoofchk(dev, ivs->vf, 1378 ivs->setting); 1379 break; --- 1561 unchanged lines hidden --- |