@@ -118,7 +118,7 @@ static int ef100_net_open(struct net_device *net_dev)
if (rc)
goto fail;
- rc = efx_set_channels(efx);
+ rc = efx_set_queues(efx);
if (rc)
goto fail;
@@ -289,7 +289,7 @@ static int efx_probe_nic(struct efx_nic *efx)
if (rc)
goto fail1;
- rc = efx_set_channels(efx);
+ rc = efx_set_queues(efx);
if (rc)
goto fail1;
@@ -780,6 +780,7 @@ static inline int efx_alloc_xdp_tx_queues(struct efx_nic *efx)
return 0;
}
+/* Assign a tx queue to one CPU for XDP_TX action */
static int efx_set_xdp_tx_queue(struct efx_nic *efx, int xdp_queue_number,
struct efx_tx_queue *tx_queue)
{
@@ -794,7 +795,11 @@ static int efx_set_xdp_tx_queue(struct efx_nic *efx, int xdp_queue_number,
return 0;
}
-static void efx_set_xdp_channels(struct efx_nic *efx)
+/* Create the cpu to tx_queue mappings for XDP_TX. Depending on the value of
+ * efx->xdp_txq_queues_mode, it may use dedicated XDP channels or shared queues
+ * with netdev core
+ */
+static void efx_set_xdp_tx_queues(struct efx_nic *efx)
{
struct efx_tx_queue *tx_queue;
struct efx_channel *channel;
@@ -915,7 +920,7 @@ int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries)
efx_init_napi_channel(efx->channel[i]);
}
- efx_set_xdp_channels(efx);
+ efx_set_xdp_tx_queues(efx);
out:
/* Destroy unused channel structures */
for (i = 0; i < efx->n_channels; i++) {
@@ -948,7 +953,10 @@ int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries)
goto out;
}
-int efx_set_channels(struct efx_nic *efx)
+/* Assign hw queues to each RX and TX queue, create the cpu->tx_queue mapping
+ * for XDP_TX and register the RX and TX queues with netdev core
+ */
+int efx_set_queues(struct efx_nic *efx)
{
struct efx_tx_queue *tx_queue;
struct efx_channel *channel;
@@ -982,7 +990,7 @@ int efx_set_channels(struct efx_nic *efx)
rc = efx_alloc_xdp_tx_queues(efx);
if (rc)
return rc;
- efx_set_xdp_channels(efx);
+ efx_set_xdp_tx_queues(efx);
rc = netif_set_real_num_tx_queues(efx->net_dev, efx->n_tx_channels);
if (rc)
@@ -35,7 +35,7 @@ int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries);
void efx_set_channel_names(struct efx_nic *efx);
int efx_init_channels(struct efx_nic *efx);
int efx_probe_channels(struct efx_nic *efx);
-int efx_set_channels(struct efx_nic *efx);
+int efx_set_queues(struct efx_nic *efx);
void efx_remove_channel(struct efx_channel *channel);
void efx_remove_channels(struct efx_nic *efx);
void efx_fini_channels(struct efx_nic *efx);
Function efx_set_channels had a bit missleading name because it was only setting some parameters related to queues, but the name suggests that much more things related to channels are being configured. Also, function efx_set_xdp_channels has been renamed to efx_xdp_tx_queues. It was even more missleading because there are cases where XDP dedicated channels might not exist, but there are still some xdp_tx queues parameters to configure, for example when sharing tx queues from normal channels for XDP. Finally, added some comments as documentation for these functions. Signed-off-by: Íñigo Huguet <ihuguet@redhat.com> --- drivers/net/ethernet/sfc/ef100_netdev.c | 2 +- drivers/net/ethernet/sfc/efx.c | 2 +- drivers/net/ethernet/sfc/efx_channels.c | 16 ++++++++++++---- drivers/net/ethernet/sfc/efx_channels.h | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-)