Skip to content

Commit 373d9a5

Browse files
shinas-marvelldavem330
authored andcommitted
octeon_ep: implement xmit_more in transmit
Add xmit_more handling in tx datapath for octeon_ep pf. Signed-off-by: Shinas Rasheed <srasheed@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2fba506 commit 373d9a5

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

drivers/net/ethernet/marvell/octeon_ep/octep_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/* Tx Queue: maximum descriptors per ring */
1616
#define OCTEP_IQ_MAX_DESCRIPTORS 1024
1717
/* Minimum input (Tx) requests to be enqueued to ring doorbell */
18-
#define OCTEP_DB_MIN 1
18+
#define OCTEP_DB_MIN 8
1919
/* Packet threshold for Tx queue interrupt */
2020
#define OCTEP_IQ_INTR_THRESHOLD 0x0
2121

drivers/net/ethernet/marvell/octeon_ep/octep_main.c

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,13 @@ static inline int octep_iq_full_check(struct octep_iq *iq)
784784
/* Stop the queue if unable to send */
785785
netif_stop_subqueue(iq->netdev, iq->q_no);
786786

787+
/* Allow for pending updates in write index
788+
* from iq_process_completion in other cpus
789+
* to reflect, in case queue gets free
790+
* entries.
791+
*/
792+
smp_mb();
793+
787794
/* check again and restart the queue, in case NAPI has just freed
788795
* enough Tx ring entries.
789796
*/
@@ -818,6 +825,7 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
818825
struct octep_iq *iq;
819826
skb_frag_t *frag;
820827
u16 nr_frags, si;
828+
int xmit_more;
821829
u16 q_no, wi;
822830

823831
if (skb_put_padto(skb, ETH_ZLEN))
@@ -830,10 +838,6 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
830838
}
831839

832840
iq = oct->iq[q_no];
833-
if (octep_iq_full_check(iq)) {
834-
iq->stats.tx_busy++;
835-
return NETDEV_TX_BUSY;
836-
}
837841

838842
shinfo = skb_shinfo(skb);
839843
nr_frags = shinfo->nr_frags;
@@ -894,19 +898,33 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
894898
hw_desc->dptr = tx_buffer->sglist_dma;
895899
}
896900

897-
netdev_tx_sent_queue(iq->netdev_q, skb->len);
901+
xmit_more = netdev_xmit_more();
902+
903+
__netdev_tx_sent_queue(iq->netdev_q, skb->len, xmit_more);
904+
898905
skb_tx_timestamp(skb);
899906
atomic_inc(&iq->instr_pending);
907+
iq->fill_cnt++;
900908
wi++;
901909
if (wi == iq->max_count)
902910
wi = 0;
903911
iq->host_write_index = wi;
912+
913+
/* octep_iq_full_check stops the queue and returns
914+
* true if so, in case the queue has become full
915+
* by inserting current packet. If so, we can
916+
* go ahead and ring doorbell.
917+
*/
918+
if (!octep_iq_full_check(iq) && xmit_more &&
919+
iq->fill_cnt < iq->fill_threshold)
920+
return NETDEV_TX_OK;
921+
904922
/* Flush the hw descriptor before writing to doorbell */
905923
wmb();
906-
907-
/* Ring Doorbell to notify the NIC there is a new packet */
908-
writel(1, iq->doorbell_reg);
909-
iq->stats.instr_posted++;
924+
/* Ring Doorbell to notify the NIC of new packets */
925+
writel(iq->fill_cnt, iq->doorbell_reg);
926+
iq->stats.instr_posted += iq->fill_cnt;
927+
iq->fill_cnt = 0;
910928
return NETDEV_TX_OK;
911929

912930
dma_map_sg_err:

0 commit comments

Comments
 (0)