X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fsfc%2Fsfc_tso.c;h=d6f1119890a2bee74a60807ead41adea4c37acd4;hb=40f840253100e4105f16e71e9cf8fd33bb51a6a0;hp=f46c0e912fb64b6476bf413ea0dfa77b4c9e473f;hpb=a3895ef38cd0219c83ffc712713dd32bfe0f6a4e;p=dpdk.git diff --git a/drivers/net/sfc/sfc_tso.c b/drivers/net/sfc/sfc_tso.c index f46c0e912f..d6f1119890 100644 --- a/drivers/net/sfc/sfc_tso.c +++ b/drivers/net/sfc/sfc_tso.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * - * Copyright (c) 2016-2018 Solarflare Communications Inc. - * All rights reserved. + * Copyright(c) 2019-2020 Xilinx, Inc. + * Copyright(c) 2016-2019 Solarflare Communications Inc. * * This software was jointly developed between OKTET Labs (under contract * for Solarflare) and Solarflare Communications, Inc. @@ -95,7 +95,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, unsigned int *pkt_descs, size_t *pkt_len) { uint8_t *tsoh; - const struct tcp_hdr *th; + const struct rte_tcp_hdr *th; efsys_dma_addr_t header_paddr; uint16_t packet_id = 0; uint32_t sent_seq; @@ -119,6 +119,8 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, /* * Discard a packet if header linearization is needed but * the header is too big. + * Duplicate Tx prepare check here to avoid spoil of + * memory if Tx prepare is skipped. */ if (unlikely(header_len > SFC_TSOH_STD_LEN)) return EMSGSIZE; @@ -144,16 +146,11 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, * IPv4 flag. If the packet is still IPv4, HW will simply start from * zero IPID. */ - if (m->ol_flags & PKT_TX_IPV4) { - const struct ipv4_hdr *iphe4; - - iphe4 = (const struct ipv4_hdr *)(tsoh + nh_off); - rte_memcpy(&packet_id, &iphe4->packet_id, sizeof(uint16_t)); - packet_id = rte_be_to_cpu_16(packet_id); - } + if (m->ol_flags & PKT_TX_IPV4) + packet_id = sfc_tso_ip4_get_ipid(tsoh, nh_off); /* Handle TCP header */ - th = (const struct tcp_hdr *)(tsoh + tcph_off); + th = (const struct rte_tcp_hdr *)(tsoh + tcph_off); rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq);