diff mbox series

[net-next,08/12] ionic: reduce the use of netdev

Message ID 20240229193935.14197-9-shannon.nelson@amd.com (mailing list archive)
State Accepted
Commit 25623ab9cb372b778a211601a1fb5e3bb72c827d
Delegated to: Netdev Maintainers
Headers show
Series ionic: code cleanup and performance tuning | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: jacob.e.keller@intel.com
netdev/build_clang success Errors and warnings before: 956 this patch: 956
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 956 this patch: 956
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 76 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-03-03--15-00 (tests: 886)

Commit Message

Nelson, Shannon Feb. 29, 2024, 7:39 p.m. UTC
To help make sure we're only accessing things we really need
to access we can cut down on the q->lif->netdev references by
using q->dev which is already in cache.

Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
---
 .../net/ethernet/pensando/ionic/ionic_txrx.c   | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
index f217b9875f1b..ed095696f67a 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
@@ -123,7 +123,6 @@  static unsigned int ionic_rx_buf_size(struct ionic_buf_info *buf_info)
 static int ionic_rx_page_alloc(struct ionic_queue *q,
 			       struct ionic_buf_info *buf_info)
 {
-	struct net_device *netdev = q->lif->netdev;
 	struct ionic_rx_stats *stats;
 	struct device *dev;
 	struct page *page;
@@ -133,14 +132,14 @@  static int ionic_rx_page_alloc(struct ionic_queue *q,
 
 	if (unlikely(!buf_info)) {
 		net_err_ratelimited("%s: %s invalid buf_info in alloc\n",
-				    netdev->name, q->name);
+				    dev_name(dev), q->name);
 		return -EINVAL;
 	}
 
 	page = alloc_pages(IONIC_PAGE_GFP_MASK, 0);
 	if (unlikely(!page)) {
 		net_err_ratelimited("%s: %s page alloc failed\n",
-				    netdev->name, q->name);
+				    dev_name(dev), q->name);
 		stats->alloc_err++;
 		return -ENOMEM;
 	}
@@ -150,7 +149,7 @@  static int ionic_rx_page_alloc(struct ionic_queue *q,
 	if (unlikely(dma_mapping_error(dev, buf_info->dma_addr))) {
 		__free_pages(page, 0);
 		net_err_ratelimited("%s: %s dma map failed\n",
-				    netdev->name, q->name);
+				    dev_name(dev), q->name);
 		stats->dma_map_err++;
 		return -EIO;
 	}
@@ -164,12 +163,11 @@  static int ionic_rx_page_alloc(struct ionic_queue *q,
 static void ionic_rx_page_free(struct ionic_queue *q,
 			       struct ionic_buf_info *buf_info)
 {
-	struct net_device *netdev = q->lif->netdev;
 	struct device *dev = q->dev;
 
 	if (unlikely(!buf_info)) {
 		net_err_ratelimited("%s: %s invalid buf_info in free\n",
-				    netdev->name, q->name);
+				    dev_name(dev), q->name);
 		return;
 	}
 
@@ -228,7 +226,7 @@  static struct sk_buff *ionic_rx_frags(struct net_device *netdev,
 	skb = napi_get_frags(&q_to_qcq(q)->napi);
 	if (unlikely(!skb)) {
 		net_warn_ratelimited("%s: SKB alloc failed on %s!\n",
-				     netdev->name, q->name);
+				     dev_name(dev), q->name);
 		stats->alloc_err++;
 		return NULL;
 	}
@@ -291,7 +289,7 @@  static struct sk_buff *ionic_rx_copybreak(struct net_device *netdev,
 	skb = napi_alloc_skb(&q_to_qcq(q)->napi, len);
 	if (unlikely(!skb)) {
 		net_warn_ratelimited("%s: SKB alloc failed on %s!\n",
-				     netdev->name, q->name);
+				     dev_name(dev), q->name);
 		stats->alloc_err++;
 		return NULL;
 	}
@@ -1086,7 +1084,7 @@  static dma_addr_t ionic_tx_map_single(struct ionic_queue *q,
 	dma_addr = dma_map_single(dev, data, len, DMA_TO_DEVICE);
 	if (dma_mapping_error(dev, dma_addr)) {
 		net_warn_ratelimited("%s: DMA single map failed on %s!\n",
-				     q->lif->netdev->name, q->name);
+				     dev_name(dev), q->name);
 		stats->dma_map_err++;
 		return 0;
 	}
@@ -1104,7 +1102,7 @@  static dma_addr_t ionic_tx_map_frag(struct ionic_queue *q,
 	dma_addr = skb_frag_dma_map(dev, frag, offset, len, DMA_TO_DEVICE);
 	if (dma_mapping_error(dev, dma_addr)) {
 		net_warn_ratelimited("%s: DMA frag map failed on %s!\n",
-				     q->lif->netdev->name, q->name);
+				     dev_name(dev), q->name);
 		stats->dma_map_err++;
 	}
 	return dma_addr;