From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f170.google.com (mail-we0-f170.google.com [74.125.82.170]) by dpdk.org (Postfix) with ESMTP id 18BABADFE for ; Fri, 13 Feb 2015 10:23:04 +0100 (CET) Received: by mail-we0-f170.google.com with SMTP id q59so15374789wes.1 for ; Fri, 13 Feb 2015 01:23:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5jqMNY+f3s8FwIfzksWp4uHeviGNtpBSEFiRY6x9Sjk=; b=d8La8pgAkU1xtDJEKBKVkjJHWvldEo+Wz3dFhXWltX1k4jkxiEcaIB/vkey5KsHyl3 W3kOG2e81R9Mjxhna8ZEfouN9yeLuEV0bvmnMM//avi8he6AdJ2EhHEiArzWxCrxfMee BLVZKRAL8rqsUnXQtBlq7p7ErBA+8hyDn82CrW2xBtyTV8cDqRnrYYw0vQehkQKEb0Xd jjfyoPjFa6FeL3vV59Kue28PTBJX7XLoIulyF5XbTT5jm5JRpbePsUYkAfIWozEh7zE/ U56wZDYevoSv6Gnby174/uTLD4U7cR77RUC8AsopPYAFtuN5z1/SafK9re2zZoo6cIbu L8mw== X-Gm-Message-State: ALoCoQn3dewl7p0RTtLa00QnFYvxNKFkjuct1K1kqh8Ys9nMzZ7Ot7/+hw68SiBUR5L8qC/fNW+q X-Received: by 10.181.12.49 with SMTP id en17mr14163478wid.62.1423819383830; Fri, 13 Feb 2015 01:23:03 -0800 (PST) Received: from glumotte.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id a5sm2100153wib.20.2015.02.13.01.23.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Feb 2015 01:23:03 -0800 (PST) From: Olivier Matz To: dev@dpdk.org Date: Fri, 13 Feb 2015 10:22:34 +0100 Message-Id: <1423819371-24222-4-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1423819371-24222-1-git-send-email-olivier.matz@6wind.com> References: <1423041925-26956-1-git-send-email-olivier.matz@6wind.com> <1423819371-24222-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v3 03/20] i40e: call i40e_txd_enable_checksum only for offloaded packets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Feb 2015 09:23:04 -0000 >>From i40e datasheet: The IP header type and its offload. In case of tunneling, the IIPT relates to the inner IP header. See also EIPT field for the outer (External) IP header offload. 00 - non IP packet or packet type is not defined by software 01 - IPv6 packet 10 - IPv4 packet with no IP checksum offload 11 - IPv4 packet with IP checksum offload Therefore it is not needed to fill the IIPT field if no offload is requested (we can keep the value to 00). For instance, the linux driver code does not set it when (skb->ip_summed != CHECKSUM_PARTIAL). We can do the same in the dpdk driver. The function i40e_txd_enable_checksum() that fills the offload registers can only be called for packets requiring an offload. Signed-off-by: Olivier Matz --- lib/librte_pmd_i40e/i40e_rxtx.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c index 8e9df96..b467461 100644 --- a/lib/librte_pmd_i40e/i40e_rxtx.c +++ b/lib/librte_pmd_i40e/i40e_rxtx.c @@ -74,6 +74,11 @@ #define I40E_TXD_CMD (I40E_TX_DESC_CMD_EOP | I40E_TX_DESC_CMD_RS) +#define I40E_TX_CKSUM_OFFLOAD_MASK ( \ + PKT_TX_IP_CKSUM | \ + PKT_TX_L4_MASK | \ + PKT_TX_OUTER_IP_CKSUM) + #define RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb) \ (uint64_t) ((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM) @@ -1272,10 +1277,12 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) /* Enable checksum offloading */ cd_tunneling_params = 0; - i40e_txd_enable_checksum(ol_flags, &td_cmd, &td_offset, - l2_len, l3_len, outer_l2_len, - outer_l3_len, - &cd_tunneling_params); + if (unlikely(ol_flags & I40E_TX_CKSUM_OFFLOAD_MASK)) { + i40e_txd_enable_checksum(ol_flags, &td_cmd, &td_offset, + l2_len, l3_len, outer_l2_len, + outer_l3_len, + &cd_tunneling_params); + } if (unlikely(nb_ctx)) { /* Setup TX context descriptor if required */ -- 2.1.4