Skip to content

Commit 2a90f7e

Browse files
simonguinotdavem330
authored andcommitted
net: mvneta: add xmit_more support
Basing on xmit_more flag of the skb, TX descriptors can be concatenated before flushing. This commit delay Tx descriptor flush if the queue is running and if there is more skb's to send. A maximum allowed number of descriptors for flushing at once due to MVNETA_TXQ_UPDATE_REG(q) reqisters limitation, is 255. Because of that a new macro was added (MVNETA_TXQ_DEC_SENT_MASK) in order to ensure that concatenated amount of descriptor does not exceed that value. Signed-off-by: Simon Guinot <[email protected]> Signed-off-by: Marcin Wojtas <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a3308d8 commit 2a90f7e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/net/ethernet/marvell/mvneta.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@
224224
#define MVNETA_TXQ_SENT_THRESH_MASK(coal) ((coal) << 16)
225225
#define MVNETA_TXQ_UPDATE_REG(q) (0x3c60 + ((q) << 2))
226226
#define MVNETA_TXQ_DEC_SENT_SHIFT 16
227+
#define MVNETA_TXQ_DEC_SENT_MASK 0xff
227228
#define MVNETA_TXQ_STATUS_REG(q) (0x3c40 + ((q) << 2))
228229
#define MVNETA_TXQ_SENT_DESC_SHIFT 16
229230
#define MVNETA_TXQ_SENT_DESC_MASK 0x3fff0000
@@ -525,6 +526,7 @@ struct mvneta_tx_queue {
525526
* descriptor ring
526527
*/
527528
int count;
529+
int pending;
528530
int tx_stop_threshold;
529531
int tx_wake_threshold;
530532

@@ -818,8 +820,9 @@ static void mvneta_txq_pend_desc_add(struct mvneta_port *pp,
818820
/* Only 255 descriptors can be added at once ; Assume caller
819821
* process TX desriptors in quanta less than 256
820822
*/
821-
val = pend_desc;
823+
val = pend_desc + txq->pending;
822824
mvreg_write(pp, MVNETA_TXQ_UPDATE_REG(txq->id), val);
825+
txq->pending = 0;
823826
}
824827

825828
/* Get pointer to next TX descriptor to be processed (send) by HW */
@@ -2399,11 +2402,15 @@ static int mvneta_tx(struct sk_buff *skb, struct net_device *dev)
23992402
struct netdev_queue *nq = netdev_get_tx_queue(dev, txq_id);
24002403

24012404
txq->count += frags;
2402-
mvneta_txq_pend_desc_add(pp, txq, frags);
2403-
24042405
if (txq->count >= txq->tx_stop_threshold)
24052406
netif_tx_stop_queue(nq);
24062407

2408+
if (!skb->xmit_more || netif_xmit_stopped(nq) ||
2409+
txq->pending + frags > MVNETA_TXQ_DEC_SENT_MASK)
2410+
mvneta_txq_pend_desc_add(pp, txq, frags);
2411+
else
2412+
txq->pending += frags;
2413+
24072414
u64_stats_update_begin(&stats->syncp);
24082415
stats->tx_packets++;
24092416
stats->tx_bytes += len;

0 commit comments

Comments
 (0)