net/ice: optimize TCP header size calculation
PATCH 1/1 net/ice: optimize TCP header size calculation
The rte_pktmbuf_read function can handle the contiguous data buffer reading, so remove the redundant contiguous memory handling.
Fixes 17c7d0f9d6a4 ("net/ice: support basic Rx/Tx")
Fixes 2a0c9ae4f646 ("net/ice: fix TCP checksum offload")
Fixes 7365a3cee51f ("net/ice: calculate TCP header size for offload")
Signed-off-by Haiyue Wang <[email protected]>
--- drivers/net/ice/ice_rxtx.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/net/ice/ice_rxtx.c +4 -10
@@ -2375,18 +2375,12 @@ ice_calc_pkt_desc(struct rte_mbuf *tx_pkt)static inline uint16_t ice_calc_pkt_tcp_hdr (struct rte_mbuf *tx_pkt,union ice_tx_offload tx_offload) { -uint16_t tcpoff = tx_offload.l2_len + tx_offload.l3_len;const struct rte_tcp_hdr *tcp_hdr; -struct rte_tcp_hdr _tcp_hdr; +struct rte_tcp_hdr tcp_hdr_buf; -if (tcpoff +sizeof (struct rte_tcp_hdr ) < tx_pkt->data_len) { - tcp_hdr = rte_pktmbuf_mtod_offset(tx_pkt, struct rte_tcp_hdr *, - tcpoff); - -return (tcp_hdr->data_off &0xf0 ) >>2 ; - } - - tcp_hdr =rte_pktmbuf_read (tx_pkt, tcpoff,sizeof (_tcp_hdr), &_tcp_hdr); + tcp_hdr =rte_pktmbuf_read (tx_pkt, + tx_offload.l2_len + tx_offload.l3_len, +sizeof (tcp_hdr_buf), &tcp_hdr_buf);if (tcp_hdr)return (tcp_hdr->data_off &0xf0 ) >>2 ;else
Signature · 1 line
2.28.0