nfp: abm: expose all PF queues

Allocate the PF representor as multi-queue to allow setting
the configuration per-queue.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jakub Kicinski 2018-05-25 21:53:34 -07:00 committed by David S. Miller
parent 0a8b7019bb
commit 2ef3c253f1
3 changed files with 16 additions and 6 deletions

View File

@ -255,14 +255,18 @@ nfp_abm_spawn_repr(struct nfp_app *app, struct nfp_abm_link *alink,
struct nfp_reprs *reprs;
struct nfp_repr *repr;
struct nfp_port *port;
unsigned int txqs;
int err;
if (ptype == NFP_PORT_PHYS_PORT)
if (ptype == NFP_PORT_PHYS_PORT) {
rtype = NFP_REPR_TYPE_PHYS_PORT;
else
txqs = 1;
} else {
rtype = NFP_REPR_TYPE_PF;
txqs = alink->vnic->max_rx_rings;
}
netdev = nfp_repr_alloc(app);
netdev = nfp_repr_alloc_mqs(app, txqs, 1);
if (!netdev)
return -ENOMEM;
repr = netdev_priv(netdev);

View File

@ -360,12 +360,13 @@ void nfp_repr_free(struct net_device *netdev)
__nfp_repr_free(netdev_priv(netdev));
}
struct net_device *nfp_repr_alloc(struct nfp_app *app)
struct net_device *
nfp_repr_alloc_mqs(struct nfp_app *app, unsigned int txqs, unsigned int rxqs)
{
struct net_device *netdev;
struct nfp_repr *repr;
netdev = alloc_etherdev(sizeof(*repr));
netdev = alloc_etherdev_mqs(sizeof(*repr), txqs, rxqs);
if (!netdev)
return NULL;

View File

@ -126,7 +126,8 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev,
u32 cmsg_port_id, struct nfp_port *port,
struct net_device *pf_netdev);
void nfp_repr_free(struct net_device *netdev);
struct net_device *nfp_repr_alloc(struct nfp_app *app);
struct net_device *
nfp_repr_alloc_mqs(struct nfp_app *app, unsigned int txqs, unsigned int rxqs);
void nfp_repr_clean_and_free(struct nfp_repr *repr);
void nfp_reprs_clean_and_free(struct nfp_app *app, struct nfp_reprs *reprs);
void nfp_reprs_clean_and_free_by_type(struct nfp_app *app,
@ -134,4 +135,8 @@ void nfp_reprs_clean_and_free_by_type(struct nfp_app *app,
struct nfp_reprs *nfp_reprs_alloc(unsigned int num_reprs);
int nfp_reprs_resync_phys_ports(struct nfp_app *app);
static inline struct net_device *nfp_repr_alloc(struct nfp_app *app)
{
return nfp_repr_alloc_mqs(app, 1, 1);
}
#endif /* NFP_NET_REPR_H */