Skip to content

Commit c06fef9

Browse files
DanielmachonPaolo Abeni
authored andcommitted
net: lan966x: ditch tx->last_in_use variable
This variable is used in the tx path to determine the last used DCB. The library has the variable last_dcb for the exact same purpose. Ditch the last_in_use variable throughout. Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 8cdd0bd commit c06fef9

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ static void lan966x_fdma_tx_disable(struct lan966x_tx *tx)
293293
lan966x, FDMA_CH_DB_DISCARD);
294294

295295
tx->activated = false;
296-
tx->last_in_use = -1;
297296
}
298297

299298
static void lan966x_fdma_tx_reload(struct lan966x_tx *tx)
@@ -598,34 +597,24 @@ static int lan966x_fdma_get_next_dcb(struct lan966x_tx *tx)
598597

599598
for (i = 0; i < fdma->n_dcbs; ++i) {
600599
dcb_buf = &tx->dcbs_buf[i];
601-
if (!dcb_buf->used && i != tx->last_in_use)
600+
if (!dcb_buf->used && &fdma->dcbs[i] != fdma->last_dcb)
602601
return i;
603602
}
604603

605604
return -1;
606605
}
607606

608-
static void lan966x_fdma_tx_start(struct lan966x_tx *tx, int next_to_use)
607+
static void lan966x_fdma_tx_start(struct lan966x_tx *tx)
609608
{
610609
struct lan966x *lan966x = tx->lan966x;
611-
struct fdma *fdma = &tx->fdma;
612-
struct fdma_dcb *dcb;
613610

614611
if (likely(lan966x->tx.activated)) {
615-
/* Connect current dcb to the next db */
616-
dcb = &fdma->dcbs[tx->last_in_use];
617-
dcb->nextptr = fdma->dma + (next_to_use *
618-
sizeof(struct fdma_dcb));
619-
620612
lan966x_fdma_tx_reload(tx);
621613
} else {
622614
/* Because it is first time, then just activate */
623615
lan966x->tx.activated = true;
624616
lan966x_fdma_tx_activate(tx);
625617
}
626-
627-
/* Move to next dcb because this last in use */
628-
tx->last_in_use = next_to_use;
629618
}
630619

631620
int lan966x_fdma_xmit_xdpf(struct lan966x_port *port, void *ptr, u32 len)
@@ -716,7 +705,7 @@ int lan966x_fdma_xmit_xdpf(struct lan966x_port *port, void *ptr, u32 len)
716705
&lan966x_fdma_xdp_tx_dataptr_cb);
717706

718707
/* Start the transmission */
719-
lan966x_fdma_tx_start(tx, next_to_use);
708+
lan966x_fdma_tx_start(tx);
720709

721710
out:
722711
spin_unlock(&lan966x->tx_lock);
@@ -799,7 +788,7 @@ int lan966x_fdma_xmit(struct sk_buff *skb, __be32 *ifh, struct net_device *dev)
799788
next_dcb_buf->ptp = true;
800789

801790
/* Start the transmission */
802-
lan966x_fdma_tx_start(tx, next_to_use);
791+
lan966x_fdma_tx_start(tx);
803792

804793
return NETDEV_TX_OK;
805794

@@ -985,7 +974,6 @@ int lan966x_fdma_init(struct lan966x *lan966x)
985974
lan966x->tx.fdma.db_size = PAGE_SIZE << lan966x->rx.page_order;
986975
lan966x->tx.fdma.ops.nextptr_cb = &fdma_nextptr_cb;
987976
lan966x->tx.fdma.ops.dataptr_cb = &lan966x_fdma_tx_dataptr_cb;
988-
lan966x->tx.last_in_use = -1;
989977

990978
err = lan966x_fdma_rx_alloc(&lan966x->rx);
991979
if (err)

drivers/net/ethernet/microchip/lan966x/lan966x_main.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,6 @@ struct lan966x_tx {
232232

233233
struct fdma fdma;
234234

235-
u16 last_in_use;
236-
237235
/* Array of dcbs that are given to the HW */
238236
struct lan966x_tx_dcb_buf *dcbs_buf;
239237

0 commit comments

Comments
 (0)