History

Merge branch 'nfp-fixes-for-v5-19'

Simon Horman says: ==================== nfp: fixes for v5.19 this short series includes two fixes for the NFP driver. 1. Restructure GRE+VLAN flower offload to address a miss match between the NIC firmware and driver implementation which prevented these features from working in combination. 2. Prevent unnecessary warnings regarding rate limiting support.- It is expected that this feature to not _always_ be present but this was not taken into account when the code to check for this feature was added. ====================

Jakub Kicinski committed 4 years ago

Commit cd3ff992 parents b489a6e a0b84333 files · +39 −37Browse files

Unified · Split

3 files
  1. drivers/net/ethernet/netronome/nfp/flower/conntrack.c +16 −16
  2. drivers/net/ethernet/netronome/nfp/flower/match.c +8 −8
  3. drivers/net/ethernet/netronome/nfp/nfp_net_sriov.c +15 −13
drivers/net/ethernet/netronome/nfp/flower/conntrack.c+16−16
@@ -507,6 +507,11 @@ nfp_fl_calc_key_layers_sz(struct nfp_fl_key_ls in_key_ls, uint16_t *map) · 506 unmodified lines
507 key_size += sizeof(struct nfp_flower_ipv6);507 key_size += sizeof(struct nfp_flower_ipv6);
508 }508 }
509 509
510 if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_QINQ) {
511 map[FLOW_PAY_QINQ] = key_size;
512 key_size += sizeof(struct nfp_flower_vlan);
513 }
514
510 if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_GRE) {515 if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_GRE) {
511 map[FLOW_PAY_GRE] = key_size;516 map[FLOW_PAY_GRE] = key_size;
512 if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6)517 if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6)
@@ -515,11 +520,6 @@ nfp_fl_calc_key_layers_sz(struct nfp_fl_key_ls in_key_ls, uint16_t *map) · 2 unmodified lines
515 key_size += sizeof(struct nfp_flower_ipv4_gre_tun);520 key_size += sizeof(struct nfp_flower_ipv4_gre_tun);
516 }521 }
517 522
518 if (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_QINQ) {
519 map[FLOW_PAY_QINQ] = key_size;
520 key_size += sizeof(struct nfp_flower_vlan);
521 }
522
523 if ((in_key_ls.key_layer & NFP_FLOWER_LAYER_VXLAN) ||523 if ((in_key_ls.key_layer & NFP_FLOWER_LAYER_VXLAN) ||
524 (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_GENEVE)) {524 (in_key_ls.key_layer_two & NFP_FLOWER_LAYER2_GENEVE)) {
525 map[FLOW_PAY_UDP_TUN] = key_size;525 map[FLOW_PAY_UDP_TUN] = key_size;
@@ -758,6 +758,17 @@ static int nfp_fl_ct_add_offload(struct nfp_fl_nft_tc_merge *m_entry) · 232 unmodified lines
758 }758 }
759 }759 }
760 760
761 if (NFP_FLOWER_LAYER2_QINQ & key_layer.key_layer_two) {
762 offset = key_map[FLOW_PAY_QINQ];
763 key = kdata + offset;
764 msk = mdata + offset;
765 for (i = 0; i < _CT_TYPE_MAX; i++) {
766 nfp_flower_compile_vlan((struct nfp_flower_vlan *)key,
767 (struct nfp_flower_vlan *)msk,
768 rules[i]);
769 }
770 }
771
761 if (key_layer.key_layer_two & NFP_FLOWER_LAYER2_GRE) {772 if (key_layer.key_layer_two & NFP_FLOWER_LAYER2_GRE) {
762 offset = key_map[FLOW_PAY_GRE];773 offset = key_map[FLOW_PAY_GRE];
763 key = kdata + offset;774 key = kdata + offset;
@@ -798,17 +809,6 @@ static int nfp_fl_ct_add_offload(struct nfp_fl_nft_tc_merge *m_entry) · 34 unmodified lines
798 }809 }
799 }810 }
800 811
801 if (NFP_FLOWER_LAYER2_QINQ & key_layer.key_layer_two) {
802 offset = key_map[FLOW_PAY_QINQ];
803 key = kdata + offset;
804 msk = mdata + offset;
805 for (i = 0; i < _CT_TYPE_MAX; i++) {
806 nfp_flower_compile_vlan((struct nfp_flower_vlan *)key,
807 (struct nfp_flower_vlan *)msk,
808 rules[i]);
809 }
810 }
811
812 if (key_layer.key_layer & NFP_FLOWER_LAYER_VXLAN ||812 if (key_layer.key_layer & NFP_FLOWER_LAYER_VXLAN ||
813 key_layer.key_layer_two & NFP_FLOWER_LAYER2_GENEVE) {813 key_layer.key_layer_two & NFP_FLOWER_LAYER2_GENEVE) {
814 offset = key_map[FLOW_PAY_UDP_TUN];814 offset = key_map[FLOW_PAY_UDP_TUN];
drivers/net/ethernet/netronome/nfp/flower/match.c+8−8
@@ -625,6 +625,14 @@ int nfp_flower_compile_flow_match(struct nfp_app *app, · 624 unmodified lines
625 msk += sizeof(struct nfp_flower_ipv6);625 msk += sizeof(struct nfp_flower_ipv6);
626 }626 }
627 627
628 if (NFP_FLOWER_LAYER2_QINQ & key_ls->key_layer_two) {
629 nfp_flower_compile_vlan((struct nfp_flower_vlan *)ext,
630 (struct nfp_flower_vlan *)msk,
631 rule);
632 ext += sizeof(struct nfp_flower_vlan);
633 msk += sizeof(struct nfp_flower_vlan);
634 }
635
628 if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_GRE) {636 if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_GRE) {
629 if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6) {637 if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6) {
630 struct nfp_flower_ipv6_gre_tun *gre_match;638 struct nfp_flower_ipv6_gre_tun *gre_match;
@@ -660,14 +668,6 @@ int nfp_flower_compile_flow_match(struct nfp_app *app, · 29 unmodified lines
660 }668 }
661 }669 }
662 670
663 if (NFP_FLOWER_LAYER2_QINQ & key_ls->key_layer_two) {
664 nfp_flower_compile_vlan((struct nfp_flower_vlan *)ext,
665 (struct nfp_flower_vlan *)msk,
666 rule);
667 ext += sizeof(struct nfp_flower_vlan);
668 msk += sizeof(struct nfp_flower_vlan);
669 }
670
671 if (key_ls->key_layer & NFP_FLOWER_LAYER_VXLAN ||671 if (key_ls->key_layer & NFP_FLOWER_LAYER_VXLAN ||
672 key_ls->key_layer_two & NFP_FLOWER_LAYER2_GENEVE) {672 key_ls->key_layer_two & NFP_FLOWER_LAYER2_GENEVE) {
673 if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6) {673 if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_TUN_IPV6) {
drivers/net/ethernet/netronome/nfp/nfp_net_sriov.c+15−13
@@ -15,7 +15,7 @@ · 14 unmodified lines
15#include "nfp_net_sriov.h"15#include "nfp_net_sriov.h"
16 16
17static int17static int
18nfp_net_sriov_check(struct nfp_app *app, int vf, u16 cap, const char *msg)18nfp_net_sriov_check(struct nfp_app *app, int vf, u16 cap, const char *msg, bool warn)
19{19{
20 u16 cap_vf;20 u16 cap_vf;
21 21
@@ -24,12 +24,14 @@ nfp_net_sriov_check(struct nfp_app *app, int vf, u16 cap, const char *msg) · 2 unmodified lines
24 24
25 cap_vf = readw(app->pf->vfcfg_tbl2 + NFP_NET_VF_CFG_MB_CAP);25 cap_vf = readw(app->pf->vfcfg_tbl2 + NFP_NET_VF_CFG_MB_CAP);
26 if ((cap_vf & cap) != cap) {26 if ((cap_vf & cap) != cap) {
27 nfp_warn(app->pf->cpp, "ndo_set_vf_%s not supported\n", msg);27 if (warn)
28 nfp_warn(app->pf->cpp, "ndo_set_vf_%s not supported\n", msg);
28 return -EOPNOTSUPP;29 return -EOPNOTSUPP;
29 }30 }
30 31
31 if (vf < 0 || vf >= app->pf->num_vfs) {32 if (vf < 0 || vf >= app->pf->num_vfs) {
32 nfp_warn(app->pf->cpp, "invalid VF id %d\n", vf);33 if (warn)
34 nfp_warn(app->pf->cpp, "invalid VF id %d\n", vf);
33 return -EINVAL;35 return -EINVAL;
34 }36 }
35 37
@@ -65,7 +67,7 @@ int nfp_app_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) · 29 unmodified lines
65 unsigned int vf_offset;67 unsigned int vf_offset;
66 int err;68 int err;
67 69
68 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_MAC, "mac");70 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_MAC, "mac", true);
69 if (err)71 if (err)
70 return err;72 return err;
71 73
@@ -101,7 +103,7 @@ int nfp_app_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos, · 29 unmodified lines
101 u32 vlan_tag;103 u32 vlan_tag;
102 int err;104 int err;
103 105
104 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_VLAN, "vlan");106 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_VLAN, "vlan", true);
105 if (err)107 if (err)
106 return err;108 return err;
107 109
@@ -115,7 +117,7 @@ int nfp_app_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos, · 7 unmodified lines
115 }117 }
116 118
117 /* Check if fw supports or not */119 /* Check if fw supports or not */
118 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_VLAN_PROTO, "vlan_proto");120 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_VLAN_PROTO, "vlan_proto", true);
119 if (err)121 if (err)
120 is_proto_sup = false;122 is_proto_sup = false;
121 123
@@ -149,7 +151,7 @@ int nfp_app_set_vf_rate(struct net_device *netdev, int vf, · 27 unmodified lines
149 u32 vf_offset, ratevalue;151 u32 vf_offset, ratevalue;
150 int err;152 int err;
151 153
152 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_RATE, "rate");154 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_RATE, "rate", true);
153 if (err)155 if (err)
154 return err;156 return err;
155 157
@@ -181,7 +183,7 @@ int nfp_app_set_vf_spoofchk(struct net_device *netdev, int vf, bool enable) · 25 unmodified lines
181 int err;183 int err;
182 184
183 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_SPOOF,185 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_SPOOF,
184 "spoofchk");186 "spoofchk", true);
185 if (err)187 if (err)
186 return err;188 return err;
187 189
@@ -205,7 +207,7 @@ int nfp_app_set_vf_trust(struct net_device *netdev, int vf, bool enable) · 17 unmodified lines
205 int err;207 int err;
206 208
207 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_TRUST,209 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_TRUST,
208 "trust");210 "trust", true);
209 if (err)211 if (err)
210 return err;212 return err;
211 213
@@ -230,7 +232,7 @@ int nfp_app_set_vf_link_state(struct net_device *netdev, int vf, · 18 unmodified lines
230 int err;232 int err;
231 233
232 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_LINK_STATE,234 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_LINK_STATE,
233 "link_state");235 "link_state", true);
234 if (err)236 if (err)
235 return err;237 return err;
236 238
@@ -265,7 +267,7 @@ int nfp_app_get_vf_config(struct net_device *netdev, int vf, · 28 unmodified lines
265 u8 flags;267 u8 flags;
266 int err;268 int err;
267 269
268 err = nfp_net_sriov_check(app, vf, 0, "");270 err = nfp_net_sriov_check(app, vf, 0, "", true);
269 if (err)271 if (err)
270 return err;272 return err;
271 273
@@ -285,13 +287,13 @@ int nfp_app_get_vf_config(struct net_device *netdev, int vf, · 13 unmodified lines
285 287
286 ivi->vlan = FIELD_GET(NFP_NET_VF_CFG_VLAN_VID, vlan_tag);288 ivi->vlan = FIELD_GET(NFP_NET_VF_CFG_VLAN_VID, vlan_tag);
287 ivi->qos = FIELD_GET(NFP_NET_VF_CFG_VLAN_QOS, vlan_tag);289 ivi->qos = FIELD_GET(NFP_NET_VF_CFG_VLAN_QOS, vlan_tag);
288 if (!nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_VLAN_PROTO, "vlan_proto"))290 if (!nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_VLAN_PROTO, "vlan_proto", false))
289 ivi->vlan_proto = htons(FIELD_GET(NFP_NET_VF_CFG_VLAN_PROT, vlan_tag));291 ivi->vlan_proto = htons(FIELD_GET(NFP_NET_VF_CFG_VLAN_PROT, vlan_tag));
290 ivi->spoofchk = FIELD_GET(NFP_NET_VF_CFG_CTRL_SPOOF, flags);292 ivi->spoofchk = FIELD_GET(NFP_NET_VF_CFG_CTRL_SPOOF, flags);
291 ivi->trusted = FIELD_GET(NFP_NET_VF_CFG_CTRL_TRUST, flags);293 ivi->trusted = FIELD_GET(NFP_NET_VF_CFG_CTRL_TRUST, flags);
292 ivi->linkstate = FIELD_GET(NFP_NET_VF_CFG_CTRL_LINK_STATE, flags);294 ivi->linkstate = FIELD_GET(NFP_NET_VF_CFG_CTRL_LINK_STATE, flags);
293 295
294 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_RATE, "rate");296 err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_RATE, "rate", false);
295 if (!err) {297 if (!err) {
296 rate = readl(app->pf->vfcfg_tbl2 + vf_offset +298 rate = readl(app->pf->vfcfg_tbl2 + vf_offset +
297 NFP_NET_VF_CFG_RATE);299 NFP_NET_VF_CFG_RATE);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t