summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2017-03-10 10:38:34 -0800
committerDavid S. Miller <davem@davemloft.net>2017-03-12 23:43:19 -0700
commit892a7f700b361882105739632ccbd6ceb848c21d (patch)
treea18225c3d7fd55ccc2b31483a56d1517d363c7fa /drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
parent9dc6b116e21b9ff258334c09d78ce26caa5ade45 (diff)
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: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c')
-rw-r--r--drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c46
1 files changed, 11 insertions, 35 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
index 63c1d9ab2335..ed22a813e579 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
@@ -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,