Commit 892a7f70 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: switch to using data path structures for reconfiguration

Instead of passing around sets of rings and their parameters just
store all information in the data path structure.

We will no longer user xchg() on XDP programs when we swap programs
while the traffic is guaranteed not to be flowing.  This allows us
to simply assign the entire data path structures instead of copying
field by field.

The optimization to reallocate only the rings on the side (RX/TX)
which has been changed is also removed since it seems like it's not
worth the code complexity.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9dc6b116
......@@ -611,12 +611,6 @@ struct nfp_net {
struct nfp_eth_table_port *eth_port;
};
struct nfp_net_ring_set {
unsigned int n_rings;
unsigned int dcnt;
void *rings;
};
/* Functions to read/write from/to a BAR
* Performs any endian conversion necessary.
*/
......@@ -813,9 +807,7 @@ nfp_net_irqs_assign(struct nfp_net *nn, struct msix_entry *irq_entries,
unsigned int n);
struct nfp_net_dp *nfp_net_clone_dp(struct nfp_net *nn);
int
nfp_net_ring_reconfig(struct nfp_net *nn, struct nfp_net_dp *new,
struct nfp_net_ring_set *rx, struct nfp_net_ring_set *tx);
int nfp_net_ring_reconfig(struct nfp_net *nn, struct nfp_net_dp *new);
#ifdef CONFIG_NFP_DEBUG
void nfp_net_debugfs_create(void);
......
......@@ -186,27 +186,16 @@ static void nfp_net_get_ringparam(struct net_device *netdev,
static int nfp_net_set_ring_size(struct nfp_net *nn, u32 rxd_cnt, u32 txd_cnt)
{
struct nfp_net_ring_set *reconfig_rx = NULL, *reconfig_tx = NULL;
struct nfp_net_ring_set rx = {
.n_rings = nn->dp.num_rx_rings,
.dcnt = rxd_cnt,
};
struct nfp_net_ring_set tx = {
.n_rings = nn->dp.num_tx_rings,
.dcnt = txd_cnt,
};
struct nfp_net_dp *dp;
if (nn->dp.rxd_cnt != rxd_cnt)
reconfig_rx = &rx;
if (nn->dp.txd_cnt != txd_cnt)
reconfig_tx = &tx;
dp = nfp_net_clone_dp(nn);
if (!dp)
return -ENOMEM;
return nfp_net_ring_reconfig(nn, dp, reconfig_rx, reconfig_tx);
dp->rxd_cnt = rxd_cnt;
dp->txd_cnt = txd_cnt;
return nfp_net_ring_reconfig(nn, dp);
}
static int nfp_net_set_ringparam(struct net_device *netdev,
......@@ -765,32 +754,19 @@ static void nfp_net_get_channels(struct net_device *netdev,
static int nfp_net_set_num_rings(struct nfp_net *nn, unsigned int total_rx,
unsigned int total_tx)
{
struct nfp_net_ring_set *reconfig_rx = NULL, *reconfig_tx = NULL;
struct nfp_net_ring_set rx = {
.n_rings = total_rx,
.dcnt = nn->dp.rxd_cnt,
};
struct nfp_net_ring_set tx = {
.n_rings = total_tx,
.dcnt = nn->dp.txd_cnt,
};
struct nfp_net_dp *dp;
if (nn->dp.num_rx_rings != total_rx)
reconfig_rx = &rx;
if (nn->dp.num_stack_tx_rings != total_tx ||
(nn->dp.xdp_prog && reconfig_rx))
reconfig_tx = &tx;
/* nfp_net_check_config() will catch tx.n_rings > nn->max_tx_rings */
if (nn->dp.xdp_prog)
tx.n_rings += total_rx;
dp = nfp_net_clone_dp(nn);
if (!dp)
return -ENOMEM;
return nfp_net_ring_reconfig(nn, dp, reconfig_rx, reconfig_tx);
dp->num_rx_rings = total_rx;
dp->num_tx_rings = total_tx;
/* nfp_net_check_config() will catch num_tx_rings > nn->max_tx_rings */
if (dp->xdp_prog)
dp->num_tx_rings += total_rx;
return nfp_net_ring_reconfig(nn, dp);
}
static int nfp_net_set_channels(struct net_device *netdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment