Skip to content

Commit e8441b1

Browse files
Amit Cohenkuba-moo
authored andcommitted
mlxsw: pci: Do not store SKB for RDQ elements
The previous patch used page pool to allocate buffers for RDQ. With this change, 'elem_info->u.rdq.skb' is not used anymore, as we do not allocate SKB before getting the packet, we hold page pointer and build the SKB around it once packet is received. Remove the union and store SKB pointer for SDQ only. Signed-off-by: Amit Cohen <amcohen@nvidia.com> Reviewed-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Link: https://lore.kernel.org/r/23a531008936dc9a1a298643fb1e4f9a7b8e6eb3.1718709196.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 0f3cd43 commit e8441b1

File tree

1 file changed

+7
-12
lines changed
  • drivers/net/ethernet/mellanox/mlxsw

1 file changed

+7
-12
lines changed

drivers/net/ethernet/mellanox/mlxsw/pci.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,9 @@ struct mlxsw_pci_mem_item {
6464
struct mlxsw_pci_queue_elem_info {
6565
struct page *page;
6666
char *elem; /* pointer to actual dma mapped element mem chunk */
67-
union {
68-
struct {
69-
struct sk_buff *skb;
70-
} sdq;
71-
struct {
72-
struct sk_buff *skb;
73-
} rdq;
74-
} u;
67+
struct {
68+
struct sk_buff *skb;
69+
} sdq;
7570
};
7671

7772
struct mlxsw_pci_queue {
@@ -557,8 +552,8 @@ static void mlxsw_pci_cqe_sdq_handle(struct mlxsw_pci *mlxsw_pci,
557552

558553
spin_lock(&q->lock);
559554
elem_info = mlxsw_pci_queue_elem_info_consumer_get(q);
560-
tx_info = mlxsw_skb_cb(elem_info->u.sdq.skb)->tx_info;
561-
skb = elem_info->u.sdq.skb;
555+
tx_info = mlxsw_skb_cb(elem_info->sdq.skb)->tx_info;
556+
skb = elem_info->sdq.skb;
562557
wqe = elem_info->elem;
563558
for (i = 0; i < MLXSW_PCI_WQE_SG_ENTRIES; i++)
564559
mlxsw_pci_wqe_frag_unmap(mlxsw_pci, wqe, i, DMA_TO_DEVICE);
@@ -573,7 +568,7 @@ static void mlxsw_pci_cqe_sdq_handle(struct mlxsw_pci *mlxsw_pci,
573568

574569
if (skb)
575570
dev_kfree_skb_any(skb);
576-
elem_info->u.sdq.skb = NULL;
571+
elem_info->sdq.skb = NULL;
577572

578573
if (q->consumer_counter++ != consumer_counter_limit)
579574
dev_dbg_ratelimited(&pdev->dev, "Consumer counter does not match limit in SDQ\n");
@@ -2007,7 +2002,7 @@ static int mlxsw_pci_skb_transmit(void *bus_priv, struct sk_buff *skb,
20072002
goto unlock;
20082003
}
20092004
mlxsw_skb_cb(skb)->tx_info = *tx_info;
2010-
elem_info->u.sdq.skb = skb;
2005+
elem_info->sdq.skb = skb;
20112006

20122007
wqe = elem_info->elem;
20132008
mlxsw_pci_wqe_c_set(wqe, 1); /* always report completion */

0 commit comments

Comments
 (0)