| @@ -15,7 +15,7 @@ · 14 unmodified lines |
| 15 | 15 | #include "nfp_net_sriov.h" |
| 16 | 16 | |
| 17 | 17 | static int |
| 18 | | −nfp_net_sriov_check(struct nfp_app *app, int vf, u16 cap, const char *msg) |
| 18 | +nfp_net_sriov_check(struct nfp_app *app, int vf, u16 cap, const char *msg, bool warn) |
| 19 | 19 | { |
| 20 | 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 | 25 | cap_vf = readw(app->pf->vfcfg_tbl2 + NFP_NET_VF_CFG_MB_CAP); |
| 26 | 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 | 29 | return -EOPNOTSUPP; |
| 29 | 30 | } |
| 30 | 31 | |
| 31 | 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 | 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 | 67 | unsigned int vf_offset; |
| 66 | 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 | 71 | if (err) |
| 70 | 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 | 103 | u32 vlan_tag; |
| 102 | 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 | 107 | if (err) |
| 106 | 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 | 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 | 121 | if (err) |
| 120 | 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 | 151 | u32 vf_offset, ratevalue; |
| 150 | 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 | 155 | if (err) |
| 154 | 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 | 183 | int err; |
| 182 | 184 | |
| 183 | 185 | err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_SPOOF, |
| 184 | | − "spoofchk"); |
| 186 | + "spoofchk", true); |
| 185 | 187 | if (err) |
| 186 | 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 | 207 | int err; |
| 206 | 208 | |
| 207 | 209 | err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_TRUST, |
| 208 | | − "trust"); |
| 210 | + "trust", true); |
| 209 | 211 | if (err) |
| 210 | 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 | 232 | int err; |
| 231 | 233 | |
| 232 | 234 | err = nfp_net_sriov_check(app, vf, NFP_NET_VF_CFG_MB_CAP_LINK_STATE, |
| 233 | | − "link_state"); |
| 235 | + "link_state", true); |
| 234 | 236 | if (err) |
| 235 | 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 | 267 | u8 flags; |
| 266 | 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 | 271 | if (err) |
| 270 | 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 | 288 | ivi->vlan = FIELD_GET(NFP_NET_VF_CFG_VLAN_VID, vlan_tag); |
| 287 | 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 | 291 | ivi->vlan_proto = htons(FIELD_GET(NFP_NET_VF_CFG_VLAN_PROT, vlan_tag)); |
| 290 | 292 | ivi->spoofchk = FIELD_GET(NFP_NET_VF_CFG_CTRL_SPOOF, flags); |
| 291 | 293 | ivi->trusted = FIELD_GET(NFP_NET_VF_CFG_CTRL_TRUST, flags); |
| 292 | 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 | 297 | if (!err) { |
| 296 | 298 | rate = readl(app->pf->vfcfg_tbl2 + vf_offset + |
| 297 | 299 | NFP_NET_VF_CFG_RATE); |