Skip to content

Commit 83a95df

Browse files
rmchelsiokuba-moo
authored andcommitted
ch_ktls: stop the txq if reaches threshold
Stop the queue and ask for the credits if queue reaches to threashold. Fixes: 5a4b9fe ("cxgb4/chcr: complete record tx handling") Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 7d01c42 commit 83a95df

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

  • drivers/net/ethernet/chelsio/inline_crypto/ch_ktls

drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ static int chcr_ktls_xmit_tcb_cpls(struct chcr_ktls_info *tx_info,
835835
{
836836
bool first_wr = ((tx_info->prev_ack == 0) && (tx_info->prev_win == 0));
837837
struct ch_ktls_port_stats_debug *port_stats;
838-
u32 len, cpl = 0, ndesc, wr_len;
838+
u32 len, cpl = 0, ndesc, wr_len, wr_mid = 0;
839839
struct fw_ulptx_wr *wr;
840840
int credits;
841841
void *pos;
@@ -851,6 +851,11 @@ static int chcr_ktls_xmit_tcb_cpls(struct chcr_ktls_info *tx_info,
851851
return NETDEV_TX_BUSY;
852852
}
853853

854+
if (unlikely(credits < ETHTXQ_STOP_THRES)) {
855+
chcr_eth_txq_stop(q);
856+
wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
857+
}
858+
854859
pos = &q->q.desc[q->q.pidx];
855860
/* make space for WR, we'll fill it later when we know all the cpls
856861
* being sent out and have complete length.
@@ -905,7 +910,8 @@ static int chcr_ktls_xmit_tcb_cpls(struct chcr_ktls_info *tx_info,
905910
wr->op_to_compl = htonl(FW_WR_OP_V(FW_ULPTX_WR));
906911
wr->cookie = 0;
907912
/* fill len in wr field */
908-
wr->flowid_len16 = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(len, 16)));
913+
wr->flowid_len16 = htonl(wr_mid |
914+
FW_WR_LEN16_V(DIV_ROUND_UP(len, 16)));
909915

910916
ndesc = DIV_ROUND_UP(len, 64);
911917
chcr_txq_advance(&q->q, ndesc);
@@ -986,6 +992,7 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb,
986992
struct tcphdr *tcp;
987993
int len16, pktlen;
988994
struct iphdr *ip;
995+
u32 wr_mid = 0;
989996
int credits;
990997
u8 buf[150];
991998
u64 cntrl1;
@@ -1010,14 +1017,19 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb,
10101017
return NETDEV_TX_BUSY;
10111018
}
10121019

1020+
if (unlikely(credits < ETHTXQ_STOP_THRES)) {
1021+
chcr_eth_txq_stop(q);
1022+
wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
1023+
}
1024+
10131025
pos = &q->q.desc[q->q.pidx];
10141026
wr = pos;
10151027

10161028
/* Firmware work request header */
10171029
wr->op_immdlen = htonl(FW_WR_OP_V(FW_ETH_TX_PKT_WR) |
10181030
FW_WR_IMMDLEN_V(ctrl));
10191031

1020-
wr->equiq_to_len16 = htonl(FW_WR_LEN16_V(len16));
1032+
wr->equiq_to_len16 = htonl(wr_mid | FW_WR_LEN16_V(len16));
10211033
wr->r3 = 0;
10221034

10231035
cpl = (void *)(wr + 1);

0 commit comments

Comments
 (0)