From patchwork Tue Sep 5 10:06:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 111648 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp2629458qge; Tue, 5 Sep 2017 03:14:39 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5yX27kAeKFQf1lnS5uEC6ftb0zW584E3OlCogiK7Qj3+lX1t9KB2w/YrYcQnSXr1tHij9x X-Received: by 10.55.134.134 with SMTP id i128mr4303099qkd.214.1504606478934; Tue, 05 Sep 2017 03:14:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504606478; cv=none; d=google.com; s=arc-20160816; b=qa7B2Z1TgAcvGXtpLqzF0YyWlefJtWZcyf4LI4gTok2/ihGN1H+nIuejFgUAjUebn7 rfNf18arzPGlPAaUoGPmGbQpicWwsPvwfhgatPxXr70Tm0h/O+WbhWnskzFtyGzFVaAW ZqMo6B93oyeixbGPwk6N7CsL3PclYmQdjLB+dHkMB57Wn58SIqRHGKRhZUmQwFNVJhjd FkjdHHy3MhXkp9I55hLJpDA55zub3zDjMR/hbcfaWNZ3SWKHbJeqA45BSMSaPk6pwwZq DSC3dNhXKeBu8ONhL/wxNRP5M1AWdHW7UENiCqBfEURG4QptviGO9kj+Rn2WqaX3iy6k 7PDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=RclXtcLxxgwo2x0z1wbj1pr4LcHVDCit0E06Tq3x+xk=; b=uctgMf3E2kqIjRNslxPveDuTYTr1wGu6DymsPlRbYu0naQXgCqIrD8NfY8CN6tXbFT gC9GJUAqpwy/kEmBpGO9AvOJ7a2DiYiV67lf/2b+BVW94aPGayEqMAlpAAcqlx3QZKb8 qCKg87Jrmg/czw3VaDHpl0erefQ9e0DLB346HA1d5uYHdYpzRiV3BLsDHBCbhw8YoW/w JcaYZ5vATnRgCE1/lg0xsEmyd4ZJuNP2JWNBHWwesnoA7nZwgtboaqigkjwS8cQoUqPc +/nSl06V2NGzB4Itfdty/8I2vejmohMzJI/6HZmq7M3OtgreMq86OiYM78XQhpYUWmZb AAPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id c29si309558qtk.385.2017.09.05.03.14.37; Tue, 05 Sep 2017 03:14:38 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 1FD40644C9; Tue, 5 Sep 2017 10:14:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id AEB3860D83; Tue, 5 Sep 2017 10:09:08 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id A6CB7618C8; Tue, 5 Sep 2017 10:08:54 +0000 (UTC) Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [5.45.198.249]) by lists.linaro.org (Postfix) with ESMTPS id 3635660D78 for ; Tue, 5 Sep 2017 10:06:42 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward106j.mail.yandex.net (Yandex) with ESMTP id 0034418041A4 for ; Tue, 5 Sep 2017 13:06:40 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id C4Iq1sgvYc-6ekivoWN; Tue, 05 Sep 2017 13:06:40 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id oPs3E3RFkM-6eOusU8T; Tue, 05 Sep 2017 13:06:40 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 5 Sep 2017 13:06:31 +0300 Message-Id: <1504605995-28026-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504605995-28026-1-git-send-email-odpbot@yandex.ru> References: <1504605995-28026-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 124 Subject: [lng-odp] [PATCH v4 1/5] linux-gen: dpdk: retrieve offload capabilities X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Signed-off-by: Bogdan Pricope --- /** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr) ** https://github.com/Linaro/odp/pull/124 ** Patch: https://github.com/Linaro/odp/pull/124.patch ** Base sha: 7508c5ac906bb7cb1d339b4c5e924f3a18e504ca ** Merge commit sha: 086fe31f96e49f97f945702d0691f019245b959c **/ platform/linux-generic/pktio/dpdk.c | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index b6d072ab..8d1dcd84 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -899,6 +899,11 @@ static void dpdk_init_capability(pktio_entry_t *pktio_entry, { pkt_dpdk_t *pkt_dpdk = &pktio_entry->s.pkt_dpdk; odp_pktio_capability_t *capa = &pkt_dpdk->capa; + int ptype_cnt; + int ptype_l3_ipv4 = 0; + int ptype_l4_tcp = 0; + int ptype_l4_udp = 0; + uint32_t ptype_mask = RTE_PTYPE_L3_MASK | RTE_PTYPE_L4_MASK; memset(dev_info, 0, sizeof(struct rte_eth_dev_info)); memset(capa, 0, sizeof(odp_pktio_capability_t)); @@ -910,9 +915,58 @@ static void dpdk_init_capability(pktio_entry_t *pktio_entry, PKTIO_MAX_QUEUES); capa->set_op.op.promisc_mode = 1; + ptype_cnt = rte_eth_dev_get_supported_ptypes(pkt_dpdk->port_id, + ptype_mask, NULL, 0); + if (ptype_cnt > 0) { + uint32_t ptypes[ptype_cnt]; + int i; + + ptype_cnt = rte_eth_dev_get_supported_ptypes(pkt_dpdk->port_id, + ptype_mask, ptypes, + ptype_cnt); + for (i = 0; i < ptype_cnt; i++) + switch (ptypes[i]) { + case RTE_PTYPE_L3_IPV4: + /* Fall through */ + case RTE_PTYPE_L3_IPV4_EXT_UNKNOWN: + /* Fall through */ + case RTE_PTYPE_L3_IPV4_EXT: + ptype_l3_ipv4 = 1; + break; + case RTE_PTYPE_L4_TCP: + ptype_l4_tcp = 1; + break; + case RTE_PTYPE_L4_UDP: + ptype_l4_udp = 1; + break; + } + } + odp_pktio_config_init(&capa->config); capa->config.pktin.bit.ts_all = 1; capa->config.pktin.bit.ts_ptp = 1; + + capa->config.pktin.bit.ipv4_chksum = ptype_l3_ipv4 && + (dev_info->rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) ? 1 : 0; + if (capa->config.pktin.bit.ipv4_chksum) + capa->config.pktin.bit.drop_ipv4_err = 1; + + capa->config.pktin.bit.udp_chksum = ptype_l4_udp && + (dev_info->rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) ? 1 : 0; + if (capa->config.pktin.bit.udp_chksum) + capa->config.pktin.bit.drop_udp_err = 1; + + capa->config.pktin.bit.tcp_chksum = ptype_l4_tcp && + (dev_info->rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) ? 1 : 0; + if (capa->config.pktin.bit.tcp_chksum) + capa->config.pktin.bit.drop_tcp_err = 1; + + capa->config.pktout.bit.ipv4_chksum = + (dev_info->tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) ? 1 : 0; + capa->config.pktout.bit.udp_chksum = + (dev_info->tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) ? 1 : 0; + capa->config.pktout.bit.tcp_chksum = + (dev_info->tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) ? 1 : 0; } static int dpdk_open(odp_pktio_t id ODP_UNUSED,