git: 8afd23de9276 - main - cxgbe: Allow parse_pkt to internally queue a packet.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Feb 2023 17:08:16 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8afd23de92768ed4c80f0c3913bf30f72635d13d commit 8afd23de92768ed4c80f0c3913bf30f72635d13d Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2023-02-17 17:03:23 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2023-02-17 17:03:23 +0000 cxgbe: Allow parse_pkt to internally queue a packet. If parse_pkt returns EINPROGRESS, return from cxgbe_transmit without queueing the packet in a txq. Use this to move the call to ethofld_transmit for packet pacing into parse_pkt. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D38577 --- sys/dev/cxgbe/adapter.h | 1 - sys/dev/cxgbe/t4_main.c | 12 ++++++------ sys/dev/cxgbe/t4_sge.c | 9 ++++++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 5460462c5f51..b470d1a6461c 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1404,7 +1404,6 @@ void t4_register_fw_msg_handler(int, fw_msg_handler_t); void t4_register_cpl_handler(int, cpl_handler_t); void t4_register_shared_cpl_handler(int, cpl_handler_t, int); #ifdef RATELIMIT -int ethofld_transmit(struct ifnet *, struct mbuf *); void send_etid_flush_wr(struct cxgbe_rate_tag *); #endif diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 33d372f575d0..71ee366e04e0 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -3062,16 +3062,16 @@ cxgbe_transmit(struct ifnet *ifp, struct mbuf *m) rc = parse_pkt(&m, vi->flags & TX_USES_VM_WR); if (__predict_false(rc != 0)) { + if (__predict_true(rc == EINPROGRESS)) { + /* queued by parse_pkt */ + MPASS(m != NULL); + return (0); + } + MPASS(m == NULL); /* was freed already */ atomic_add_int(&pi->tx_parse_error, 1); /* rare, atomic is ok */ return (rc); } -#ifdef RATELIMIT - if (m->m_pkthdr.csum_flags & CSUM_SND_TAG) { - if (m->m_pkthdr.snd_tag->sw->type == IF_SND_TAG_TYPE_RATE_LIMIT) - return (ethofld_transmit(ifp, m)); - } -#endif /* Select a txq. */ sc = vi->adapter; diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 88a7f44cadb7..ad3cb63dade4 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -345,6 +345,7 @@ static inline u_int txpkt_eo_len16(u_int, u_int, u_int); #endif static int ethofld_fw4_ack(struct sge_iq *, const struct rss_header *, struct mbuf *); +static int ethofld_transmit(struct ifnet *, struct mbuf *); #endif static counter_u64_t extfree_refs; @@ -2960,6 +2961,10 @@ restart: set_mbuf_eo_nsegs(m0, nsegs); set_mbuf_eo_len16(m0, txpkt_eo_len16(nsegs, immhdrs, needs_tso(m0))); + rc = ethofld_transmit(mst->ifp, m0); + if (rc != 0) + goto fail; + return (EINPROGRESS); } #endif #endif @@ -6847,7 +6852,7 @@ ethofld_tx(struct cxgbe_rate_tag *cst) } } -int +static int ethofld_transmit(struct ifnet *ifp, struct mbuf *m0) { struct cxgbe_rate_tag *cst; @@ -6903,8 +6908,6 @@ ethofld_transmit(struct ifnet *ifp, struct mbuf *m0) done: mtx_unlock(&cst->lock); - if (__predict_false(rc != 0)) - m_freem(m0); return (rc); }