diff mbox series

[net-next,3/5] sfc: rename set_channels to set_queues and document it

Message ID 20220510084443.14473-4-ihuguet@redhat.com (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series sfc: refactor of efx_set_channels | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 5 maintainers not CCed: daniel@iogearbox.net bpf@vger.kernel.org john.fastabend@gmail.com hawk@kernel.org ast@kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 70 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Íñigo Huguet May 10, 2022, 8:44 a.m. UTC
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(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/sfc/ef100_netdev.c b/drivers/net/ethernet/sfc/ef100_netdev.c
index 67fe44db6b61..fe8253d59782 100644
--- a/drivers/net/ethernet/sfc/ef100_netdev.c
+++ b/drivers/net/ethernet/sfc/ef100_netdev.c
@@ -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;
 
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 5a772354da83..3d8a83b94e0a 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -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;
 
diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/efx_channels.c
index 8feba80f0a34..1c05063a7215 100644
--- a/drivers/net/ethernet/sfc/efx_channels.c
+++ b/drivers/net/ethernet/sfc/efx_channels.c
@@ -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)
diff --git a/drivers/net/ethernet/sfc/efx_channels.h b/drivers/net/ethernet/sfc/efx_channels.h
index 64abb99a56b8..148e22415b05 100644
--- a/drivers/net/ethernet/sfc/efx_channels.h
+++ b/drivers/net/ethernet/sfc/efx_channels.h
@@ -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);