Skip to content

Commit 9bbdd41

Browse files
Jakub Kicinskiborkmann
authored andcommitted
nfp: allow apps to request larger MTU on control vNIC
Some apps may want to have higher MTU on the control vNIC/queue. Allow them to set the requested MTU at init time. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 28264eb commit 9bbdd41

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

drivers/net/ethernet/netronome/nfp/nfp_app.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040

4141
#include "nfp_net_repr.h"
4242

43+
#define NFP_APP_CTRL_MTU_MAX U32_MAX
44+
4345
struct bpf_prog;
4446
struct net_device;
4547
struct netdev_bpf;
@@ -178,6 +180,7 @@ struct nfp_app_type {
178180
* @ctrl: pointer to ctrl vNIC struct
179181
* @reprs: array of pointers to representors
180182
* @type: pointer to const application ops and info
183+
* @ctrl_mtu: MTU to set on the control vNIC (set in .init())
181184
* @priv: app-specific priv data
182185
*/
183186
struct nfp_app {
@@ -189,6 +192,7 @@ struct nfp_app {
189192
struct nfp_reprs __rcu *reprs[NFP_REPR_TYPE_MAX + 1];
190193

191194
const struct nfp_app_type *type;
195+
unsigned int ctrl_mtu;
192196
void *priv;
193197
};
194198

drivers/net/ethernet/netronome/nfp/nfp_net_common.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3877,10 +3877,20 @@ int nfp_net_init(struct nfp_net *nn)
38773877
return err;
38783878

38793879
/* Set default MTU and Freelist buffer size */
3880-
if (nn->max_mtu < NFP_NET_DEFAULT_MTU)
3880+
if (!nfp_net_is_data_vnic(nn) && nn->app->ctrl_mtu) {
3881+
if (nn->app->ctrl_mtu <= nn->max_mtu) {
3882+
nn->dp.mtu = nn->app->ctrl_mtu;
3883+
} else {
3884+
if (nn->app->ctrl_mtu != NFP_APP_CTRL_MTU_MAX)
3885+
nn_warn(nn, "app requested MTU above max supported %u > %u\n",
3886+
nn->app->ctrl_mtu, nn->max_mtu);
3887+
nn->dp.mtu = nn->max_mtu;
3888+
}
3889+
} else if (nn->max_mtu < NFP_NET_DEFAULT_MTU) {
38813890
nn->dp.mtu = nn->max_mtu;
3882-
else
3891+
} else {
38833892
nn->dp.mtu = NFP_NET_DEFAULT_MTU;
3893+
}
38843894
nn->dp.fl_bufsz = nfp_net_calc_fl_bufsz(&nn->dp);
38853895

38863896
if (nfp_app_ctrl_uses_data_vnics(nn->app))

0 commit comments

Comments
 (0)