From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr60049.outbound.protection.outlook.com [40.107.6.49]) by dpdk.org (Postfix) with ESMTP id 7BE922BF3 for ; Wed, 17 Jan 2018 15:04:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=rdgaqAbDmqdVL9h3PwvJLYrLyiN6oQjZ6OlqJyh/vSk=; b=FRdLez9Bm/RI82JEBwE2rldrValr279DtKwDaYTY1OtrUBNUyNjcCM9Gim5GwSGgZxDNzHk1imA/HvSDwdZp8dTW7PGMEm+sv2Z02t4tl4XvHyRTlcBx7JFsnknl/sX1AkmzUTpUY4IR7HPTi8zGF5JTKkdyEYE1cX5DL4d4UxQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by VI1PR05MB3215.eurprd05.prod.outlook.com (2603:10a6:802:1b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Wed, 17 Jan 2018 14:04:54 +0000 From: Moti Haimovsky To: pascal.mazon@6wind.com Cc: ferruh.yigit@intel.com, dev@dpdk.org, Moti Haimovsky Date: Wed, 17 Jan 2018 16:04:34 +0200 Message-Id: <1516197874-133169-2-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516197874-133169-1-git-send-email-motih@mellanox.com> References: <1515601248-39458-2-git-send-email-motih@mellanox.com> <1516197874-133169-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR06CA0147.eurprd06.prod.outlook.com (2603:10a6:7:16::34) To VI1PR05MB3215.eurprd05.prod.outlook.com (2603:10a6:802:1b::32) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 94118ec4-ccbb-4a17-e1a3-08d55db34938 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR05MB3215; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3215; 3:LYJ8JJFjmCGoxQvZ05TCEcqBWT6o/8k1+eh9SD19nsGCLNbRKvcRDXfAN36W6r/GN4NqRpDXzJzLT0y0w2cBkqArhlt8uB6GRvvKEVT7zw9xcnPlIek1N5vGW21ySEhKrLyKNSusZQVm/7UZvDz7I4BtfemYXJbnDwmzNm5FaKC1MmIfRYNFoqfJ57PXeZ7X/HyLGjlYJ8jzJDoOonnZu/8C2YqSdMo55V+EZp36nQAeOOHUCFCWWocGMEQn/wB2; 25:u1LrtI4/Y0xVKGSTTloeAkblGixv1rtBaStP6rJro2eIydX6CZgtwr1f81R8iXfLelkjBEwXaDqaX703Gu00ZWEI2qjWQndhTv/Kr/+UnMiqRNYzJpJSw2MitSJbS9sLfU3W7iFHZ3TaA9jHlLqYYbWu9rXwAHuJgZe5wq8hCpOenpvovzEgQzK3m2Q5YjL3Ptdw85SmMcZCkJ+Hs848RQGxJ2Iu0W60BmLCxhY9Ix4vh4s/x08MlP/Rrh5ttEdlVFS4p0LQjsn0HYgcnP/7yqInMe1j9m7WN30WRSfcrxyBof8+W/fRobPUHpx4u+44hH09ojiVx1zkyj/3eTdsdQ==; 31:qJiuTUJfJgW7PcEHnHG/Ll5owKavbtA1yI0G8AddWhJuLy7pFI313x0bK0cBHLuIGBmoceBB8yGq3L+n1iIRBATTFevlrdHbTUilKRNegVzt/RF7aVi5CndbIlZ1Q/GCigKL0cW5ivedZUsehM/Q//yP3FSHWA+P7q36gwoMT+QGYcs78lOERs6YdoCyZyeMVnFfaQWX3RSCER3Nq9nJbFn5GWzV0J94EnV1PIFr3MI= X-MS-TrafficTypeDiagnostic: VI1PR05MB3215: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3215; 20:u2AoXGCOzXwmFsV3D0/B+WjRg1KsB4s05L9Kozp+NdAkiMGr7gR8M0ggYQ6gFPZ2zWaggiJ2cUG1JE25eB1YFNzSI+JS2GwJBvWCVJ5+CmrkfdBBKXPS8x7isoaUP4AXFV9t7rk9JFozyvop6JDy1q9dyHbMnJwdI69FSC33yIeGLIYPLVCkT48JI6DkHqZ6AH4gbfblsWKkfbLyhtgHOar5PmMpvlKd9HSJDycwVc+LronZ95gTnAxFXi6INEtbMUthZ2f5HLGX43AN66OoWPYLoOktvOatFQEmCNbus7Kk6/EORgUCloGc2fAwABhv1jHc5Lq8vFWFD9xsuTvkwXWwEK7n+exKKl0HfMcM/O4clpMwmZM8HT6X/9/fBVkkdI1fugexp0uEfkSOacfrbVbiRHv/xgR4l3HsuLEfS2ZY6JmY6kl+JeX/s6MQCVcMR5KgbH3UsgmmhJ56x+uVuFsApr6dkQgs1SxpOd2dbpU58fDCl+XdQrQ87wemf22C; 4:K5g9mG7zAcT0vCIH9e9vA7j1VwYvUavoXxZFiKbHyRUDag5TSCBWTzG7DRopBf8L6P1MGt1bPgi8nW25FIlsGeOWNSfxG4+sC2oYzla2zhuFz0SR/lARi1l/HFfRUP72E8zVwxGibEbgsVMIrdXpnldxVhKgHHUns28mPsvTzxpt+2hGubljknZ7XXPZVnpHEYI8S8zzQ7OnmiWAUOdJmWaELxDW5gGCr2THEL7WKRyfY4zBjRtMJmVpIVtdmhsdf3zRcCKCHA0ucY6lRZRg7w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(3231023)(944501161)(10201501046)(6055026)(6041268)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:VI1PR05MB3215; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR05MB3215; X-Forefront-PRVS: 0555EC8317 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(346002)(366004)(39380400002)(39860400002)(189003)(199004)(51416003)(97736004)(106356001)(69596002)(6666003)(4720700003)(305945005)(105586002)(33026002)(5660300001)(26005)(2950100002)(6916009)(76176011)(478600001)(59450400001)(50226002)(81156014)(8936002)(8676002)(81166006)(2351001)(386003)(21086003)(68736007)(316002)(2361001)(16586007)(86362001)(50466002)(2906002)(48376002)(107886003)(3846002)(16526018)(55016002)(25786009)(53936002)(4326008)(52116002)(7696005)(7736002)(6116002)(66066001)(36756003)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB3215; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB3215; 23:w4tKrvZQYyucp8djbEdkWWtsEA5Sdlb+9OzfjfjSN?= =?us-ascii?Q?4PSJS+4yN22eWDwnKlzo6TtsGKa3GxrHMuhdpMQ7MASdp+Q710dGk3ccQprf?= =?us-ascii?Q?iYjhUHxusJqSHTu6seh35RB8wIyNj3ronmlpps8GQYPHNaop5b7Xfo3uNPP3?= =?us-ascii?Q?UqDrtASaLtd5eJl+LVAkFcOAHzVYXWqt1DI8O6j0zxbx2FfypBst/b2jJZ3A?= =?us-ascii?Q?zwJh5Nr4iP2WPGlofHQCnPQ6eIrSZQuMjIGdpaSB40e4x2+7+g6Vs/1543Kk?= =?us-ascii?Q?5F1GkeFEo1d8FnLUuoE7109K4ffPtMErLmenu3bIwZbUf1h2Vcdbh2le7ugm?= =?us-ascii?Q?mJlhzmXAh8t2kOuSNXgm1xYDas3fOiyQMTe66Zq3q7+r76ZurPEvOaIM2Soz?=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X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3215; 6:eo5ZtgCg5Abcbf2iMycaMFVJMjBX7LGstR5tMcGwNGjFTGVMqLNlVBePjcWez9k1hyT6lmccwBYhfoDN+odYmwgjgDjN2cvxwfzULjttXZ/nzvKoxzkQREis6XqqxG+UMh1DcQTYkHzUVd2jH+ZoCvyrOkUvaVBDgN8spcx+BUnjnCEXvH9dmrtGi2iougbzPCS3LJ9GDEfjcxXqkTxjYYP6ehHlqZq8om2Z/7KA5FuSKnM/5bm13vg9vvCyZFAnfvv9yizBfPFHaA2FV+rnye/G1yzAayZrkf+l2H759J+2a4XVTMyirC/vO0fGRXKkrLweCM2Yy7I2dXBQ0TrhuGc4zO9UYgYKcz/SlY6dCQc=; 5:klw3Y2Pii8xNbjgabNXA1nnhCQRcQbJo0/DYd1Sf5LkeKg5JxsBwCh4Dv7kGnqxB1dg0GhfunbPODYBKsEzahjAfoC0FpamGnFVOficrLMXr7D7N/+ggC48SYBFtkBhR0/52oWVVShyQtRTEUgWngaTeu7k6549SmIdnCrQDlL4=; 24:sr6HkWEYyJ5OP7p3ew/OxfQBj7NhaNvwjObUMeXqQxaG/bxjHz9OjgtLv9AfmzRD5y3FmoiovbmihdwqaTe8fhEXyDcqo79dMSku04dlem4=; 7:3cAWSd1f1Ctg0rpTfsUyIWGDwootsKz0oUkwmb4WAzQJva+qnmyzH1Hu1Xj5fZLrGsY5itfIppGswcLrKCdLjm+hW2RYycI7rn7EU2ZjENWv7kbBNXRFYiZow6EKZTy1OTf4FaniCLvREfoiiLH5oL9yd98axrYJH1nZHcRbDRPLIMX73GaL984qpgNvB7UEcbJqRmNfnobOclskhJAe38nLy6u4U9nQpSHBCLHvkUJEFaftvSsKfWDCD0DEtXnQ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2018 14:04:54.3193 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 94118ec4-ccbb-4a17-e1a3-08d55db34938 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB3215 Subject: [dpdk-dev] [PATCH V5 2/2] net/tap: use 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: Wed, 17 Jan 2018 14:04:56 -0000 Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") This commit adds support for the new Rx offloads API. Signed-off-by: Moti Haimovsky --- V5: * Fixed compilation errors caused by not using PRIx64 in log messages when displaying uint64_t values. * Modified patch name V4: Modifications according to inputs from Pascal Mazon * Removed extra braces. V3: * Fixed coding style warnings V2: * Fixed coding style warnings --- drivers/net/tap/rte_eth_tap.c | 67 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 8 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 7357dce..2eb8734 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -253,6 +253,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. */ @@ -277,8 +314,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; @@ -333,7 +371,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 */ @@ -694,12 +732,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 @@ -1015,6 +1053,19 @@ 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%" PRIx64 + " don't match port offloads 0x%" PRIx64 + " or supported offloads 0x%" PRIx64 "\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; -- 1.8.3.1