From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10536C31E45 for ; Thu, 13 Jun 2019 11:45:35 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 9B15C21743 for ; Thu, 13 Jun 2019 11:45:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="ojtHOnEx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B15C21743 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=marvell.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 691F31D3FB; Thu, 13 Jun 2019 13:45:13 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id EA6781D3F0 for ; Thu, 13 Jun 2019 13:45:08 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5DBj8rI008523 for ; Thu, 13 Jun 2019 04:45:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=kYld9SD9t8uN7CM0p09ScxewKUeM9CZejbZWWFeFh8o=; b=ojtHOnEx0vXwH4Jl0L9lAEAc68YqAO9YNN/7Fd5qA1gUaPfBc407hLRkENP7jySReGqm Q50audNLbtWHX94nYOKxB9MpOsBrOztYvBHML3w9ogTfrfE6CTj2Yxof2TqsrWUh9300 +2FZ3oNKBdkae0Zq5ngxGXO5XH+TGfP08NuepYDxYA+MHRWjZy7AgTrrgmPNSV99YrOi VMzkL/Gkj1hAWsn7xRVwKhwzREqWyEAfvXwlzvPWae3mzxNwpGaY48iXRr8RyP/KA3hu qVNcjPL62llY8M5iXKQUyhmnHdu8Rw6vEFxoLMzh3mUl8JJVIikSsnuJ+bATBaotZNeP SA== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2t3j820t3q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 13 Jun 2019 04:45:08 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 13 Jun 2019 04:45:07 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 13 Jun 2019 04:45:07 -0700 Received: from pt-lxl0023.marvell.com (pt-lxl0023.marvell.com [10.5.213.12]) by maili.marvell.com (Postfix) with ESMTP id 75D203F7045; Thu, 13 Jun 2019 04:45:06 -0700 (PDT) From: To: CC: Liron Himi Date: Thu, 13 Jun 2019 16:58:25 +0300 Message-ID: <1560434305-9359-4-git-send-email-lironh@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560434305-9359-1-git-send-email-lironh@marvell.com> References: <1560258407-26378-1-git-send-email-lironh@marvell.com> <1560434305-9359-1-git-send-email-lironh@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-13_07:, , signatures=0 Subject: [dpdk-dev] [PATCH v2 3/3] net/mvneta: only use ol_flags for checksum generation offload X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Liron Himi Signed-off-by: Liron Himi Reviewed-by: Yuri Chipchev Tested-by: Liron Himi --- drivers/net/mvneta/mvneta_ethdev.c | 9 ------ drivers/net/mvneta/mvneta_ethdev.h | 14 +++++++++ drivers/net/mvneta/mvneta_rxtx.c | 62 ++++++++++++++------------------------ 3 files changed, 36 insertions(+), 49 deletions(-) diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index f324d93..d46a13b 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -27,15 +27,6 @@ #define MVNETA_IFACE_NAME_ARG "iface" -#define MVNETA_RX_OFFLOADS (DEV_RX_OFFLOAD_JUMBO_FRAME | \ - DEV_RX_OFFLOAD_CHECKSUM) - -/** Port Tx offloads capabilities */ -#define MVNETA_TX_OFFLOADS (DEV_TX_OFFLOAD_IPV4_CKSUM | \ - DEV_TX_OFFLOAD_UDP_CKSUM | \ - DEV_TX_OFFLOAD_TCP_CKSUM | \ - DEV_TX_OFFLOAD_MULTI_SEGS) - #define MVNETA_PKT_SIZE_MAX (16382 - MV_MH_SIZE) /* 9700B */ #define MVNETA_DEFAULT_MTU 1500 diff --git a/drivers/net/mvneta/mvneta_ethdev.h b/drivers/net/mvneta/mvneta_ethdev.h index d892d6c..ef80677 100644 --- a/drivers/net/mvneta/mvneta_ethdev.h +++ b/drivers/net/mvneta/mvneta_ethdev.h @@ -53,6 +53,20 @@ #define MRVL_NETA_MTU_TO_MRU(mtu) ((mtu) + MRVL_NETA_HDRS_LEN) #define MRVL_NETA_MRU_TO_MTU(mru) ((mru) - MRVL_NETA_HDRS_LEN) +/** Rx offloads capabilities */ +#define MVNETA_RX_OFFLOADS (DEV_RX_OFFLOAD_JUMBO_FRAME | \ + DEV_RX_OFFLOAD_CHECKSUM) + +/** Tx offloads capabilities */ +#define MVNETA_TX_OFFLOAD_CHECKSUM (DEV_TX_OFFLOAD_IPV4_CKSUM | \ + DEV_TX_OFFLOAD_UDP_CKSUM | \ + DEV_TX_OFFLOAD_TCP_CKSUM) +#define MVNETA_TX_OFFLOADS (MVNETA_TX_OFFLOAD_CHECKSUM | \ + DEV_TX_OFFLOAD_MULTI_SEGS) + +#define MVNETA_TX_PKT_OFFLOADS (PKT_TX_IP_CKSUM | \ + PKT_TX_TCP_CKSUM | \ + PKT_TX_UDP_CKSUM) struct mvneta_priv { /* Hot fields, used in fast path. */ diff --git a/drivers/net/mvneta/mvneta_rxtx.c b/drivers/net/mvneta/mvneta_rxtx.c index 62caa68..10b6f57 100644 --- a/drivers/net/mvneta/mvneta_rxtx.c +++ b/drivers/net/mvneta/mvneta_rxtx.c @@ -280,8 +280,6 @@ mvneta_desc_to_packet_type_and_offset(struct neta_ppio_desc *desc, * * @param ol_flags * Offload flags. - * @param packet_type - * Packet type bitfield. * @param l3_type * Pointer to the neta_ouq_l3_type structure. * @param l4_type @@ -290,41 +288,34 @@ mvneta_desc_to_packet_type_and_offset(struct neta_ppio_desc *desc, * Will be set to 1 in case l3 checksum is computed. * @param l4_cksum * Will be set to 1 in case l4 checksum is computed. - * - * @return - * 0 on success, negative error value otherwise. */ -static inline int -mvneta_prepare_proto_info(uint64_t ol_flags, uint32_t packet_type, - enum neta_outq_l3_type *l3_type, - enum neta_outq_l4_type *l4_type, - int *gen_l3_cksum, - int *gen_l4_cksum) +static inline void +mvneta_prepare_proto_info(uint64_t ol_flags, + enum neta_outq_l3_type *l3_type, + enum neta_outq_l4_type *l4_type, + int *gen_l3_cksum, + int *gen_l4_cksum) { /* * Based on ol_flags prepare information * for neta_ppio_outq_desc_set_proto_info() which setups descriptor * for offloading. + * in most of the checksum cases ipv4 must be set, so this is the + * default value */ - if (ol_flags & PKT_TX_IPV4) { - *l3_type = NETA_OUTQ_L3_TYPE_IPV4; - *gen_l3_cksum = ol_flags & PKT_TX_IP_CKSUM ? 1 : 0; - } else if (ol_flags & PKT_TX_IPV6) { + *l3_type = NETA_OUTQ_L3_TYPE_IPV4; + *gen_l3_cksum = ol_flags & PKT_TX_IP_CKSUM ? 1 : 0; + + if (ol_flags & PKT_TX_IPV6) { *l3_type = NETA_OUTQ_L3_TYPE_IPV6; /* no checksum for ipv6 header */ *gen_l3_cksum = 0; - } else { - /* if something different then stop processing */ - return -1; } - ol_flags &= PKT_TX_L4_MASK; - if ((packet_type & RTE_PTYPE_L4_TCP) && - ol_flags == PKT_TX_TCP_CKSUM) { + if (ol_flags & PKT_TX_TCP_CKSUM) { *l4_type = NETA_OUTQ_L4_TYPE_TCP; *gen_l4_cksum = 1; - } else if ((packet_type & RTE_PTYPE_L4_UDP) && - ol_flags == PKT_TX_UDP_CKSUM) { + } else if (ol_flags & PKT_TX_UDP_CKSUM) { *l4_type = NETA_OUTQ_L4_TYPE_UDP; *gen_l4_cksum = 1; } else { @@ -332,8 +323,6 @@ mvneta_prepare_proto_info(uint64_t ol_flags, uint32_t packet_type, /* no checksum for other type */ *gen_l4_cksum = 0; } - - return 0; } /** @@ -385,8 +374,7 @@ mvneta_tx_pkt_burst(void *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) struct mvneta_txq *q = txq; struct mvneta_shadow_txq *sq; struct neta_ppio_desc descs[nb_pkts]; - - int i, ret, bytes_sent = 0; + int i, bytes_sent = 0; uint16_t num, sq_free_size; uint64_t addr; @@ -419,13 +407,10 @@ mvneta_tx_pkt_burst(void *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) bytes_sent += rte_pktmbuf_pkt_len(mbuf); - ret = mvneta_prepare_proto_info(mbuf->ol_flags, - mbuf->packet_type, - &l3_type, &l4_type, - &gen_l3_cksum, - &gen_l4_cksum); - if (unlikely(ret)) + if (!(mbuf->ol_flags & MVNETA_TX_PKT_OFFLOADS)) continue; + mvneta_prepare_proto_info(mbuf->ol_flags, &l3_type, &l4_type, + &gen_l3_cksum, &gen_l4_cksum); neta_ppio_outq_desc_set_proto_info(&descs[i], l3_type, l4_type, mbuf->l2_len, @@ -473,7 +458,7 @@ mvneta_tx_sg_pkt_burst(void *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) struct neta_ppio_desc descs[nb_pkts * NETA_PPIO_DESC_NUM_FRAGS]; struct neta_ppio_sg_pkts pkts; uint8_t frags[nb_pkts]; - int i, j, ret, bytes_sent = 0; + int i, j, bytes_sent = 0; int tail, tail_first; uint16_t num, sq_free_size; uint16_t nb_segs, total_descs = 0; @@ -549,13 +534,10 @@ mvneta_tx_sg_pkt_burst(void *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) bytes_sent += rte_pktmbuf_pkt_len(mbuf); - ret = mvneta_prepare_proto_info(mbuf->ol_flags, - mbuf->packet_type, - &l3_type, &l4_type, - &gen_l3_cksum, - &gen_l4_cksum); - if (unlikely(ret)) + if (!(mbuf->ol_flags & MVNETA_TX_PKT_OFFLOADS)) continue; + mvneta_prepare_proto_info(mbuf->ol_flags, &l3_type, &l4_type, + &gen_l3_cksum, &gen_l4_cksum); neta_ppio_outq_desc_set_proto_info(&descs[tail_first], l3_type, l4_type, -- 2.7.4