From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id C1AE61B025 for ; Fri, 5 Jan 2018 09:26:04 +0100 (CET) Received: by mail-wm0-f68.google.com with SMTP id b141so996501wme.1 for ; Fri, 05 Jan 2018 00:26:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=rHWbVouMwikliJ2OPgSpe0yghbqzgtXDoFRDTpzeYuM=; b=K2NwcQLqSrPzkJCt1N9V6L+XFMRvHETrH1VVrrBbiIpIk3K5qi8g9KF/FBDZDhdkYL GjljeI1c/AAMBh/8SImkH61GWVcPRxHTQMGXON0A6kD8FxW3PBwwP+QyTWeUGOzBmAaU BEMOj+42umDS3kwAKgnjb/8uPMd5L3W4SERKtKhW50pYa2UuFctBsfhv6Vb4fYGdl021 eEwzt7t6y356JKsb/4sQo4DwAEJKqCPEHSJzXwIzM1f+CrYNB3rT2wwr8lzwWQ1MT+nO vW47r+PzUPOJvuifHw6p1S0fbEaOAedxhdHhMtMvJ66Jhg3fGlYj9iVSvueMjVRAh8L0 92tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=rHWbVouMwikliJ2OPgSpe0yghbqzgtXDoFRDTpzeYuM=; b=P2WT54+Y3oDYPPppRdrJ6uASVwcvntVYpaXYkzdpMbdLfI4y/xxjojLbOAmG/ineMY FP1MZ5I+yqPeGNSWphK7CTdIKJUc3pmBwEeY9hbR0prOB2HKbf5JRzMUevwoiW/Z93VO 3vqHjcZAnrnIJswJzpO7PlIVp9FKFK7n07eR/aTaGwquzD6bkCSaTp6eT/0YTDV9IB6t Y+YCrg6xGw6KSWlbSwaZMsxX/qHXv1oRrqh/R6W9UKSFf5oa2nRsMtB9V6cTAAcLp2eK FiM3GLXt+uIwCtjwyoX/55W9lpkXjHgakpFi0/ewCPfeh7eMS8YIiUoyS3XXh5ro7x40 Tx8Q== X-Gm-Message-State: AKGB3mKSX9vqjobNtvilLI7qeMkkHOD+uI0tT8Jwroj79uvH6DVuoFMv L36gHlFOFV8Pc03sfWo+d1ejxGZzJms= X-Google-Smtp-Source: ACJfBosM60LakHyNRae0BrqxcViOjGFqHh49OM1n9kGHcqR210XCrF5xiVEPQ1cYjAtNCPd/8vn4Yw== X-Received: by 10.80.177.28 with SMTP id k28mr3046134edd.124.1515140764247; Fri, 05 Jan 2018 00:26:04 -0800 (PST) Received: from [192.168.1.58] (82.107.69.91.rev.sfr.net. [91.69.107.82]) by smtp.gmail.com with ESMTPSA id b30sm3841027ede.53.2018.01.05.00.26.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jan 2018 00:26:03 -0800 (PST) To: Moti Haimovsky Cc: dev@dpdk.org References: <1515093521-185221-1-git-send-email-motih@mellanox.com> <1515093521-185221-3-git-send-email-motih@mellanox.com> From: Pascal Mazon Message-ID: <6e9eec49-6594-c926-fb1f-680d6125af57@6wind.com> Date: Fri, 5 Jan 2018 09:26:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <1515093521-185221-3-git-send-email-motih@mellanox.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH V3 2/2] net/tap: convert to new Rx offloads API 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: , X-List-Received-Date: Fri, 05 Jan 2018 08:26:05 -0000 Hi, As you did in the previous patch, you can use less parentheses for this line: + if (((port_offloads ^ offloads) & port_supp_offloads)) Otherwise ok. Best regards, Pascal On 04/01/2018 20:18, Moti Haimovsky wrote: > Ethdev Rx offloads API has changed since: > commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") > This commit support the new Rx offloads API. > > Signed-off-by: Moti Haimovsky > --- > V3: > * Fixed coding style warnings > > V2: > * Fixed coding style warnings > --- > drivers/net/tap/rte_eth_tap.c | 66 +++++++++++++++++++++++++++++++++++++------ > 1 file changed, 58 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c > index 1a84adb..f08c37c 100644 > --- a/drivers/net/tap/rte_eth_tap.c > +++ b/drivers/net/tap/rte_eth_tap.c > @@ -286,6 +286,43 @@ enum ioctl_mode { > } > } > > +static uint64_t > +tap_rx_offload_get_port_capa(void) > +{ > + /* > + * In order to support legacy apps, > + * report capabilities also as port capabilities. > + */ > + return DEV_RX_OFFLOAD_SCATTER | > + DEV_RX_OFFLOAD_IPV4_CKSUM | > + DEV_RX_OFFLOAD_UDP_CKSUM | > + DEV_RX_OFFLOAD_TCP_CKSUM; > +} > + > +static uint64_t > +tap_rx_offload_get_queue_capa(void) > +{ > + return DEV_RX_OFFLOAD_SCATTER | > + DEV_RX_OFFLOAD_IPV4_CKSUM | > + DEV_RX_OFFLOAD_UDP_CKSUM | > + DEV_RX_OFFLOAD_TCP_CKSUM; > +} > + > +static bool > +tap_rxq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) > +{ > + uint64_t port_offloads = dev->data->dev_conf.rxmode.offloads; > + uint64_t queue_supp_offloads = tap_rx_offload_get_queue_capa(); > + uint64_t port_supp_offloads = tap_rx_offload_get_port_capa(); > + > + if ((offloads & (queue_supp_offloads | port_supp_offloads)) != > + offloads) > + return false; > + if (((port_offloads ^ offloads) & port_supp_offloads)) > + return false; > + return true; > +} > + > /* Callback to handle the rx burst of packets to the correct interface and > * file descriptor(s) in a multi-queue setup. > */ > @@ -310,8 +347,9 @@ enum ioctl_mode { > int len; > > len = readv(rxq->fd, *rxq->iovecs, > - 1 + (rxq->rxmode->enable_scatter ? > - rxq->nb_rx_desc : 1)); > + 1 + > + (rxq->rxmode->offloads & DEV_RX_OFFLOAD_SCATTER ? > + rxq->nb_rx_desc : 1)); > if (len < (int)sizeof(struct tun_pi)) > break; > > @@ -366,7 +404,7 @@ enum ioctl_mode { > seg->next = NULL; > mbuf->packet_type = rte_net_get_ptype(mbuf, NULL, > RTE_PTYPE_ALL_MASK); > - if (rxq->rxmode->hw_ip_checksum) > + if (rxq->rxmode->offloads & DEV_RX_OFFLOAD_CHECKSUM) > tap_verify_csum(mbuf); > > /* account for the receive frame */ > @@ -727,12 +765,12 @@ enum ioctl_mode { > dev_info->min_rx_bufsize = 0; > dev_info->pci_dev = NULL; > dev_info->speed_capa = tap_dev_speed_capa(); > - dev_info->rx_offload_capa = (DEV_RX_OFFLOAD_IPV4_CKSUM | > - DEV_RX_OFFLOAD_UDP_CKSUM | > - DEV_RX_OFFLOAD_TCP_CKSUM); > + dev_info->rx_queue_offload_capa = tap_rx_offload_get_queue_capa(); > + dev_info->rx_offload_capa = tap_rx_offload_get_port_capa() | > + dev_info->rx_queue_offload_capa; > dev_info->tx_queue_offload_capa = tap_tx_offload_get_queue_capa(); > - dev_info->tx_offload_capa = dev_info->tx_queue_offload_capa | > - tap_tx_offload_get_port_capa(); > + dev_info->tx_offload_capa = tap_tx_offload_get_port_capa() | > + dev_info->tx_queue_offload_capa; > } > > static int > @@ -1048,6 +1086,18 @@ enum ioctl_mode { > return -1; > } > > + /* Verify application offloads are valid for our port and queue. */ > + if (!tap_rxq_are_offloads_valid(dev, rx_conf->offloads)) { > + rte_errno = ENOTSUP; > + RTE_LOG(ERR, PMD, > + "%p: Rx queue offloads 0x%lx don't match port " > + "offloads 0x%lx or supported offloads 0x%lx\n", > + (void *)dev, rx_conf->offloads, > + dev->data->dev_conf.rxmode.offloads, > + (tap_rx_offload_get_port_capa() | > + tap_rx_offload_get_queue_capa())); > + return -rte_errno; > + } > rxq->mp = mp; > rxq->trigger_seen = 1; /* force initial burst */ > rxq->in_port = dev->data->port_id;