From patchwork Wed Oct 10 16:14:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ophir Munk X-Patchwork-Id: 981979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="H9qcv3LG"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42VfLN2MMmz9sB7 for ; Thu, 11 Oct 2018 03:14:19 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0669D7AA; Wed, 10 Oct 2018 16:14:17 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 1EAE95B1 for ; Wed, 10 Oct 2018 16:14:16 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0088.outbound.protection.outlook.com [104.47.0.88]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 15047773 for ; Wed, 10 Oct 2018 16:14:14 +0000 (UTC) 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:X-MS-Exchange-SenderADCheck; bh=LOoQvZCXfun0SfvVFwXR/w4blvAWdlL9zBiHajClUHs=; b=H9qcv3LGzIO43fZ7qlHLB1HvWpD+jRIrjKuAqOfQY7DibU4V9fu3KoGLctPMjdQstKqPaZBqwCwNlJDMPFj3pj+ATlWtBoBW/STIH+Z842V02PBMSE/rPYVmbRou8NsE9r2mysZlHXxP3Vf36dCdpf4gvtB0sopeIiGd0usPjOE= Received: from VI1PR0502MB3743.eurprd05.prod.outlook.com (52.134.8.154) by VI1PR0502MB3790.eurprd05.prod.outlook.com (52.134.9.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.28; Wed, 10 Oct 2018 16:14:10 +0000 Received: from VI1PR0502MB3743.eurprd05.prod.outlook.com ([fe80::fd5f:be55:2063:d2de]) by VI1PR0502MB3743.eurprd05.prod.outlook.com ([fe80::fd5f:be55:2063:d2de%3]) with mapi id 15.20.1228.020; Wed, 10 Oct 2018 16:14:10 +0000 From: Ophir Munk To: "ovs-dev@openvswitch.org" Thread-Topic: [dpdk-howl PATCH v5 1/2] netdev-dpdk: Upgrade to dpdk v18.08 Thread-Index: AQHUYLRGlYx86NxLC0+3VfBU8IF0Iw== Date: Wed, 10 Oct 2018 16:14:10 +0000 Message-ID: <1539188042-20673-1-git-send-email-ophirmu@mellanox.com> References: <1537382075-26789-1-git-send-email-ophirmu@mellanox.com> In-Reply-To: <1537382075-26789-1-git-send-email-ophirmu@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: DB6PR07CA0004.eurprd07.prod.outlook.com (2603:10a6:6:2d::14) To VI1PR0502MB3743.eurprd05.prod.outlook.com (2603:10a6:803:11::26) authentication-results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0502MB3790; 6:YRbM//8qbi2Aj6TDCSNJ3ec20k7yRL5r5Q9H9bNLZXER83TzDWx5fyqBHoC6kacgy3TP1VmTWPvNon9/JpbA3zSaM0ZCVx6yE07US/MWFnvRiDcKBy192xliJjysLv+KW/4bdyfaIwYZTDRK7XjUT+xGQLEsf8ys1bwB5I8SdioLD4Zx5w24rN1dRriESmMpT51Y+CQ9NB6Zl7gEHuHzl3+5If/fDnlX9BRZfFTMPrupzUFlNcom/XcpsLRt9Ps1BAcWSkXA4l6qoN3WUG/HpRu5RlZGWW+aZHFJaPcWjVu4QyAnwbKXInDMBdOkpfgH8E6ACuoiCHiO4IHlFbQmQGAC+r723df5rFFyY0NiT1H/E1WeP3GjgLkmpB435zNyL6WllbzEyngYU5hLNk7WZ+/8822qPvoRNGStsyTL2MY40fGEt0bF4retLbufY7TsHwVkBi2AmNWJzaOMEJqBCA==; 5:vfEdV03AJFYx/51ex0BZ2NHAYbf/QzlPE5KQESFbRXmkgUGzPRciIvyFDLtHU0W6EBAOnJ2qi7EUQqCxg3OrJOJiLqSbn6IDatcHqvDh5uzlrd3lAJ4wDsAf5MmhYJrAQowdfpKZh7Cjv8q/lh1xdL4vi8YL2Y+61fi471A2U5U=; 7:z1ETIK0WwwXDpirqLLFd/RXLdBWsbirLq1OBh4L1juQ+O1UEcuueKbZpekL/6jVEpRH3rq64NDxCR/WgWMdZWlCJZMLNKBHOB/t+YUpI46g4VtlCz82R6xaGA/9g/jQJOADZsey/17BReRpH6MYcpgE/SrQthwEk7cdtVLjaUsLJN7mqffDqEdxpTL36+cJ5U6bEPma0Jk8Ux8pwsrm4HUXv/V0XLYplXDZmHelAt+jwS6ofkf/C+InzPs/lOEtn x-ms-office365-filtering-correlation-id: 8660a4be-2ca2-49f1-9f4a-08d62ecb692d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0502MB3790; x-ms-traffictypediagnostic: VI1PR0502MB3790: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(788757137089)(166708455590820)(158342451672863)(163750095850); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231355)(944501410)(4982022)(52105095)(93006095)(93001095)(10201501046)(6055026)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991055); SRVR:VI1PR0502MB3790; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0502MB3790; x-forefront-prvs: 08213D42D3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(376002)(136003)(39860400002)(366004)(199004)(189003)(4744004)(305945005)(5250100002)(86362001)(52116002)(575784001)(8936002)(53376002)(6436002)(6506007)(386003)(102836004)(5024004)(14444005)(316002)(6116002)(486006)(2616005)(66066001)(99286004)(446003)(476003)(6486002)(3846002)(5640700003)(2501003)(68736007)(11346002)(4326008)(14454004)(106356001)(25786009)(6916009)(105586002)(2906002)(6512007)(6306002)(54906003)(76176011)(478600001)(81166006)(8676002)(81156014)(53946003)(36756003)(5660300001)(2900100001)(97736004)(7736002)(186003)(71200400001)(26005)(71190400001)(53936002)(966005)(256004)(2351001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB3790; H:VI1PR0502MB3743.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: cCrOLkKckDPaHuI4TaeqRnv7PSn1Eq4XY5JVjqnMN87bBaUcpVmV/IVfRe17AOBuPSqd69Q7b1+H2WoQeoaTxOzp0RhRrAvVP5J3m9N4eLrg+LFJKvz9XQrqQntTGIEeAMDYcu60PZZE/Z1+y1/tKys2KI2erYTSvSJlbq46tcrYCgPCc4AzBN1o9Vrl4DParBmjwnzLtSDi9xVI93Bs3GVbss1c4lWbFf+CE3VEP6zarMGIiZfEnnmL0ms8TUOX3QXygV2A9/Hf6hnx15Cc/xclL+Q9h58U9U8XeegrDxSERo/BWlaNUGXSlWMVHkNMjRqQNNCe2qcNWl7emI5+hSB0ymsBlJs7rfWrnBf6cKg= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8660a4be-2ca2-49f1-9f4a-08d62ecb692d X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Oct 2018 16:14:10.0621 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB3790 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Shahaf Shuler , Asaf Penso , Thomas Monjalon Subject: [ovs-dev] [dpdk-howl PATCH v5 1/2] netdev-dpdk: Upgrade to dpdk v18.08 X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 1. Enable compilation and linkage with dpdk 18.08.0 The following dpdk commits which were introduced after dpdk 17.11.x require OVS updates to accommodate to the dpdk changes. - ce17edde ("ethdev: introduce Rx queue offloads API") - ab3ce1e0 ("ethdev: remove old offload API") - c06ddf96 ("meter: add configuration profile") - e58638c3 ("ethdev: fix TPID handling in flow API") - cd8c7c7c ("ethdev: replace bus specific struct with generic dev") - ac8d22de ("ethdev: flatten RSS configuration in flow API") 2. Limit configured rss hash functions to only those supported by the eth device. 3. Set default RSS key in struct action_rss_data, required by OVS commit - e8a2b5bf ("netdev-dpdk: implement flow offload with rte flow") when configured with "other_config:hw-offload=true" Remark: calling RSS with 0 length (default) key is rejected in DPDK 18.08 and will be enabled in DPDK 18.11. It has no effect when running in a "hw-offload=false" configuration. 4. Update references to DPDK version 18.08 in Documentation and in travis linux-build script 5. There are currently warnings on DPDK deprecated functions calls: - rte_eth_dev_attach - rte_eth_dev_detach - rte_eth_devargs_parse The deprecated functions calls replacements will be added to DPDK 18.11. Signed-off-by: Ophir Munk --- v1: First version v2: Avoid seg faults cases as described in https://patchwork.ozlabs.org/patch/965451/ by using the patch in: https://github.com/kevintraynor/ovs-dpdk- master/commit/88f46cc5ab338eb4f3ca5db1eacd0effefe4fa0c v3: - rebase on latest dpdk-hwol branch - Updates based on latest reviews to versions v1 & v2 v4: This patch got lost in mailing list server due to administrative issues and is now obsolete v5: - updated commit message - Address all reviews (some skipped by mistake) from recent versions - it is suggested to ignore deprecated functions warnings as the functions replacements are missing in DPDK 18.08 and will be added to DPDK 18.11 .travis/linux-build.sh | 2 +- Documentation/intro/install/dpdk.rst | 14 ++-- Documentation/topics/dpdk/vhost-user.rst | 6 +- lib/netdev-dpdk.c | 130 ++++++++++++++++++++----------- 4 files changed, 95 insertions(+), 57 deletions(-) diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh index 4b9fc4a..4c9e952 100755 --- a/.travis/linux-build.sh +++ b/.travis/linux-build.sh @@ -83,7 +83,7 @@ fi if [ "$DPDK" ]; then if [ -z "$DPDK_VER" ]; then - DPDK_VER="17.11.3" + DPDK_VER="18.08" fi install_dpdk $DPDK_VER if [ "$CC" = "clang" ]; then diff --git a/Documentation/intro/install/dpdk.rst b/Documentation/intro/install/dpdk.rst index 36501c6..73610ef 100644 --- a/Documentation/intro/install/dpdk.rst +++ b/Documentation/intro/install/dpdk.rst @@ -42,7 +42,7 @@ Build requirements In addition to the requirements described in :doc:`general`, building Open vSwitch with DPDK will require the following: -- DPDK 17.11.3 +- DPDK 18.08.0 - A `DPDK supported NIC`_ @@ -71,9 +71,9 @@ Install DPDK #. Download the `DPDK sources`_, extract the file and set ``DPDK_DIR``:: $ cd /usr/src/ - $ wget http://fast.dpdk.org/rel/dpdk-17.11.3.tar.xz - $ tar xf dpdk-17.11.3.tar.xz - $ export DPDK_DIR=/usr/src/dpdk-stable-17.11.3 + $ wget http://fast.dpdk.org/rel/dpdk-18.08.tar.xz + $ tar xf dpdk-18.08.tar.xz + $ export DPDK_DIR=/usr/src/dpdk-stable-18.08 $ cd $DPDK_DIR #. (Optional) Configure DPDK as a shared library @@ -283,9 +283,9 @@ with either the ovs-vswitchd logs, or by running either of the commands:: $ ovs-vswitchd --version ovs-vswitchd (Open vSwitch) 2.9.0 - DPDK 17.11.0 + DPDK 18.08.0 $ ovs-vsctl get Open_vSwitch . dpdk_version - "DPDK 17.11.0" + "DPDK 18.08.0" At this point you can use ovs-vsctl to set up bridges and other Open vSwitch features. Seeing as we've configured the DPDK datapath, we will use DPDK-type @@ -673,7 +673,7 @@ Limitations The latest list of validated firmware versions can be found in the `DPDK release notes`_. -.. _DPDK release notes: http://dpdk.org/doc/guides/rel_notes/release_17_11.html +.. _DPDK release notes: http://dpdk.org/doc/guides/rel_notes/release_18_08.html - Upper bound MTU: DPDK device drivers differ in how the L2 frame for a given MTU value is calculated e.g. i40e driver includes 2 x vlan headers in diff --git a/Documentation/topics/dpdk/vhost-user.rst b/Documentation/topics/dpdk/vhost-user.rst index b1e2285..56f58ba 100644 --- a/Documentation/topics/dpdk/vhost-user.rst +++ b/Documentation/topics/dpdk/vhost-user.rst @@ -320,9 +320,9 @@ To begin, instantiate a guest as described in :ref:`dpdk-vhost-user` or DPDK sources to VM and build DPDK:: $ cd /root/dpdk/ - $ wget http://fast.dpdk.org/rel/dpdk-17.11.3.tar.xz - $ tar xf dpdk-17.11.3.tar.xz - $ export DPDK_DIR=/root/dpdk/dpdk-stable-17.11.3 + $ wget http://fast.dpdk.org/rel/dpdk-18.08.tar.xz + $ tar xf dpdk-18.08.tar.xz + $ export DPDK_DIR=/root/dpdk/dpdk-stable-18.08 $ export DPDK_TARGET=x86_64-native-linuxapp-gcc $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET $ cd $DPDK_DIR diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index f91aa27..4dd0ec3 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -168,11 +168,7 @@ static const struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, .split_hdr_size = 0, - .header_split = 0, /* Header Split disabled */ - .hw_ip_checksum = 0, /* IP checksum offload disabled */ - .hw_vlan_filter = 0, /* VLAN filtering disabled */ - .jumbo_frame = 0, /* Jumbo Frame Support disabled */ - .hw_strip_crc = 0, + .offloads = 0, }, .rx_adv_conf = { .rss_conf = { @@ -364,6 +360,7 @@ struct dpdk_ring { struct ingress_policer { struct rte_meter_srtcm_params app_srtcm_params; struct rte_meter_srtcm in_policer; + struct rte_meter_srtcm_profile in_prof; rte_spinlock_t policer_lock; }; @@ -894,6 +891,8 @@ dpdk_eth_dev_port_config(struct netdev_dpdk *dev, int n_rxq, int n_txq) struct rte_eth_dev_info info; uint16_t conf_mtu; + rte_eth_dev_info_get(dev->port_id, &info); + /* As of DPDK 17.11.1 a few PMDs require to explicitly enable * scatter to support jumbo RX. Checking the offload capabilities * is not an option as PMDs are not required yet to report @@ -901,20 +900,25 @@ dpdk_eth_dev_port_config(struct netdev_dpdk *dev, int n_rxq, int n_txq) * (testing or code review). Listing all such PMDs feels harder * than highlighting the one known not to need scatter */ if (dev->mtu > ETHER_MTU) { - rte_eth_dev_info_get(dev->port_id, &info); if (strncmp(info.driver_name, "net_nfp", 7)) { - conf.rxmode.enable_scatter = 1; + conf.rxmode.offloads |= DEV_RX_OFFLOAD_SCATTER; } } conf.intr_conf.lsc = dev->lsc_interrupt_mode; - conf.rxmode.hw_ip_checksum = (dev->hw_ol_features & - NETDEV_RX_CHECKSUM_OFFLOAD) != 0; + + if (dev->hw_ol_features & NETDEV_RX_CHECKSUM_OFFLOAD) { + conf.rxmode.offloads |= DEV_RX_OFFLOAD_CHECKSUM; + } if (dev->hw_ol_features & NETDEV_RX_HW_CRC_STRIP) { - conf.rxmode.hw_strip_crc = 1; + conf.rxmode.offloads |= DEV_RX_OFFLOAD_CRC_STRIP; } + /* Limit configured rss hash functions to only those supported + * by the eth device. */ + conf.rx_adv_conf.rss_conf.rss_hf &= info.flow_type_rss_offloads; + /* A device may report more queues than it makes available (this has * been observed for Intel xl710, which reserves some of them for * SRIOV): rte_eth_*_queue_setup will fail if a queue is not @@ -1932,16 +1936,18 @@ netdev_dpdk_eth_tx_burst(struct netdev_dpdk *dev, int qid, static inline bool netdev_dpdk_policer_pkt_handle(struct rte_meter_srtcm *meter, + struct rte_meter_srtcm_profile *profile, struct rte_mbuf *pkt, uint64_t time) { uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) - sizeof(struct ether_hdr); - return rte_meter_srtcm_color_blind_check(meter, time, pkt_len) == - e_RTE_METER_GREEN; + return rte_meter_srtcm_color_blind_check(meter, profile, time, pkt_len) == + e_RTE_METER_GREEN; } static int netdev_dpdk_policer_run(struct rte_meter_srtcm *meter, + struct rte_meter_srtcm_profile *profile, struct rte_mbuf **pkts, int pkt_cnt, bool should_steal) { @@ -1953,7 +1959,8 @@ netdev_dpdk_policer_run(struct rte_meter_srtcm *meter, for (i = 0; i < pkt_cnt; i++) { pkt = pkts[i]; /* Handle current packet */ - if (netdev_dpdk_policer_pkt_handle(meter, pkt, current_time)) { + if (netdev_dpdk_policer_pkt_handle(meter, profile, + pkt, current_time)) { if (cnt != i) { pkts[cnt] = pkt; } @@ -1975,8 +1982,8 @@ ingress_policer_run(struct ingress_policer *policer, struct rte_mbuf **pkts, int cnt = 0; rte_spinlock_lock(&policer->policer_lock); - cnt = netdev_dpdk_policer_run(&policer->in_policer, pkts, - pkt_cnt, should_steal); + cnt = netdev_dpdk_policer_run(&policer->in_policer, &policer->in_prof, + pkts, pkt_cnt, should_steal); rte_spinlock_unlock(&policer->policer_lock); return cnt; @@ -2767,8 +2774,12 @@ netdev_dpdk_policer_construct(uint32_t rate, uint32_t burst) policer->app_srtcm_params.cir = rate_bytes; policer->app_srtcm_params.cbs = burst_bytes; policer->app_srtcm_params.ebs = 0; - err = rte_meter_srtcm_config(&policer->in_policer, - &policer->app_srtcm_params); + err = rte_meter_srtcm_profile_config(&policer->in_prof, + &policer->app_srtcm_params); + if (!err) { + err = rte_meter_srtcm_config(&policer->in_policer, + &policer->in_prof); + } if (err) { VLOG_ERR("Could not create rte meter for ingress policer"); free(policer); @@ -3043,13 +3054,18 @@ netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) smap_add_format(args, "if_descr", "%s %s", rte_version(), dev_info.driver_name); - if (dev_info.pci_dev) { - smap_add_format(args, "pci-vendor_id", "0x%x", - dev_info.pci_dev->id.vendor_id); - smap_add_format(args, "pci-device_id", "0x%x", - dev_info.pci_dev->id.device_id); + const struct rte_bus *bus; + const struct rte_pci_device *pci_dev; + bus = rte_bus_find_by_device(dev_info.device); + if (bus && !strcmp(bus->name, "pci")) { + pci_dev = RTE_DEV_TO_PCI(dev_info.device); + if (pci_dev) { + smap_add_format(args, "pci-vendor_id", "0x%x", + pci_dev->id.vendor_id); + smap_add_format(args, "pci-device_id", "0x%x", + pci_dev->id.device_id); + } } - return 0; } @@ -3727,6 +3743,7 @@ struct egress_policer { struct qos_conf qos_conf; struct rte_meter_srtcm_params app_srtcm_params; struct rte_meter_srtcm egress_meter; + struct rte_meter_srtcm_profile egress_prof; }; static void @@ -3749,11 +3766,17 @@ egress_policer_qos_construct(const struct smap *details, policer = xmalloc(sizeof *policer); qos_conf_init(&policer->qos_conf, &egress_policer_ops); egress_policer_details_to_param(details, &policer->app_srtcm_params); - err = rte_meter_srtcm_config(&policer->egress_meter, - &policer->app_srtcm_params); + err = rte_meter_srtcm_profile_config(&policer->egress_prof, + &policer->app_srtcm_params); + if (!err) { + err = rte_meter_srtcm_config(&policer->egress_meter, + &policer->egress_prof); + } + if (!err) { *conf = &policer->qos_conf; } else { + VLOG_ERR("Could not create rte meter for egress policer"); free(policer); *conf = NULL; err = -err; @@ -3803,7 +3826,8 @@ egress_policer_run(struct qos_conf *conf, struct rte_mbuf **pkts, int pkt_cnt, struct egress_policer *policer = CONTAINER_OF(conf, struct egress_policer, qos_conf); - cnt = netdev_dpdk_policer_run(&policer->egress_meter, pkts, + cnt = netdev_dpdk_policer_run(&policer->egress_meter, + &policer->egress_prof, pkts, pkt_cnt, should_steal); return cnt; @@ -3888,7 +3912,7 @@ dpdk_vhost_reconfigure_helper(struct netdev_dpdk *dev) if (!err) { /* A new mempool was created or re-used. */ netdev_change_seq_changed(&dev->up); - } else if (err != EEXIST){ + } else if (err != EEXIST) { return err; } if (netdev_dpdk_get_vid(dev) >= 0) { @@ -4103,15 +4127,15 @@ dump_flow_pattern(struct rte_flow_item *item) VLOG_DBG("rte flow vlan pattern:\n"); if (vlan_spec) { - VLOG_DBG(" Spec: tpid=0x%"PRIx16", tci=0x%"PRIx16"\n", - ntohs(vlan_spec->tpid), ntohs(vlan_spec->tci)); + VLOG_DBG(" Spec: inner_type=0x%"PRIx16", tci=0x%"PRIx16"\n", + ntohs(vlan_spec->inner_type), ntohs(vlan_spec->tci)); } else { VLOG_DBG(" Spec = null\n"); } if (vlan_mask) { - VLOG_DBG(" Mask: tpid=0x%"PRIx16", tci=0x%"PRIx16"\n", - vlan_mask->tpid, vlan_mask->tci); + VLOG_DBG(" Mask: inner_type=0x%"PRIx16", tci=0x%"PRIx16"\n", + vlan_mask->inner_type, vlan_mask->tci); } else { VLOG_DBG(" Mask = null\n"); } @@ -4281,27 +4305,39 @@ add_flow_action(struct flow_actions *actions, enum rte_flow_action_type type, actions->cnt++; } +struct action_rss_data { + struct rte_flow_action_rss conf; + uint16_t queue[0]; +}; + static struct rte_flow_action_rss * add_flow_rss_action(struct flow_actions *actions, struct netdev *netdev) { int i; - struct rte_flow_action_rss *rss; - - rss = xmalloc(sizeof(*rss) + sizeof(uint16_t) * netdev->n_rxq); - /* - * Setting it to NULL will let the driver use the default RSS - * configuration we have set: &port_conf.rx_adv_conf.rss_conf. - */ - rss->rss_conf = NULL; - rss->num = netdev->n_rxq; + struct action_rss_data *rss_data; + + rss_data = xmalloc(sizeof(struct action_rss_data) + + sizeof(uint16_t) * netdev->n_rxq); + *rss_data = (struct action_rss_data) { + .conf = (struct rte_flow_action_rss) { + .func = RTE_ETH_HASH_FUNCTION_DEFAULT, + .level = 0, + .types = ETH_RSS_IP, + .key_len = 0, + .queue_num = netdev->n_rxq, + .queue = rss_data->queue, + .key = NULL + }, + }; - for (i = 0; i < rss->num; i++) { - rss->queue[i] = i; + /* Override queue array with default */ + for (i = 0; i < netdev->n_rxq; i++) { + rss_data->queue[i] = i; } - add_flow_action(actions, RTE_FLOW_ACTION_TYPE_RSS, rss); + add_flow_action(actions, RTE_FLOW_ACTION_TYPE_RSS, &rss_data->conf); - return rss; + return &rss_data->conf; } static int @@ -4365,7 +4401,7 @@ netdev_dpdk_add_rte_flow_offload(struct netdev *netdev, vlan_mask.tci = match->wc.masks.vlans[0].tci & ~htons(VLAN_CFI); /* match any protocols */ - vlan_mask.tpid = 0; + vlan_mask.inner_type = 0; add_flow_pattern(&patterns, RTE_FLOW_ITEM_TYPE_VLAN, &vlan_spec, &vlan_mask); @@ -4520,7 +4556,9 @@ end_proto_check: flow = rte_flow_create(dev->port_id, &flow_attr, patterns.items, actions.actions, &error); - free(rss); + void *rss_cont; + rss_cont = container_of(rss, struct action_rss_data, conf); + free(rss_cont); if (!flow) { VLOG_ERR("rte flow creat error: %u : message : %s\n", error.type, error.message); From patchwork Wed Oct 10 16:14:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ophir Munk X-Patchwork-Id: 981980 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="vBUppj9a"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42VfMF4R5hz9sB7 for ; Thu, 11 Oct 2018 03:15:05 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 02194890; Wed, 10 Oct 2018 16:14:19 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 2036888D for ; Wed, 10 Oct 2018 16:14:17 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0088.outbound.protection.outlook.com [104.47.0.88]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 5388C773 for ; Wed, 10 Oct 2018 16:14:16 +0000 (UTC) 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:X-MS-Exchange-SenderADCheck; bh=WX4RepOJSTtwaYYTebKVAYXPWIjpkdXjyUM7ZV/ySbw=; b=vBUppj9aPx1C7TOF9mpyDAc5u8Ds+m769TDuD9LvEuH2O+8OpF1/0Ddvw6nwRyniQrdwRRdVAnwwPM0uJYz2WlpqwvIWvKERE/Y9EAu97DhbBEcbyMPLFBTZqoM5BufDypZBZeiLjGjLc/isNGe/MFlMD6sqIMJms886D/KZ6vs= Received: from VI1PR0502MB3743.eurprd05.prod.outlook.com (52.134.8.154) by VI1PR0502MB3790.eurprd05.prod.outlook.com (52.134.9.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.28; Wed, 10 Oct 2018 16:14:11 +0000 Received: from VI1PR0502MB3743.eurprd05.prod.outlook.com ([fe80::fd5f:be55:2063:d2de]) by VI1PR0502MB3743.eurprd05.prod.outlook.com ([fe80::fd5f:be55:2063:d2de%3]) with mapi id 15.20.1228.020; Wed, 10 Oct 2018 16:14:11 +0000 From: Ophir Munk To: "ovs-dev@openvswitch.org" Thread-Topic: [dpdk-howl PATCH v5 2/2] netdev-dpdk: Set scatter based on capabilities Thread-Index: AQHUYLRHN9zRXkeg/E6bgHiIEhauTQ== Date: Wed, 10 Oct 2018 16:14:11 +0000 Message-ID: <1539188042-20673-2-git-send-email-ophirmu@mellanox.com> References: <1537382075-26789-1-git-send-email-ophirmu@mellanox.com> <1539188042-20673-1-git-send-email-ophirmu@mellanox.com> In-Reply-To: <1539188042-20673-1-git-send-email-ophirmu@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: DB6PR07CA0004.eurprd07.prod.outlook.com (2603:10a6:6:2d::14) To VI1PR0502MB3743.eurprd05.prod.outlook.com (2603:10a6:803:11::26) authentication-results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0502MB3790; 6:pQoWbnqQocV0qn3ilKKz+zguAAEZId7MAmflYVwPPrCaKOhPA8/gF+OOzMpErf2TqVJpFqenkkvpjDHGM11CFt6hgSuOJ3d9Ye52T70Sy9Jg2U/bkMFxDFUNcGfbIluZTdiLqcHE5Y7TKSt5g0UIJJ/ZUxBllUxa7Qd93cnD+Y0h9r+N+0mX7bHgZNRv+GZ/neuC5A77u6+dlG02X5axPOobc9Eg41NMlqkiPBjD4ZtNw20Zprq56+0fGg1UZpxph/cTEmj8GLREkCnX4ymLQyh2GwMyDiiiAv3CGlcWm1XozG6KlpRo+GuBLKr2FtSgJMF3yw3XvBPKe9VKMvYwMEVnqF12IZU4/nPsQFVc5Xf1StYBh7CsEGYd8R/AGijHqCVJCJEXtyvdTDKXmEzbZvlnrq90OxH5CgkXFKE3rsJQjoM3XYXUBMyCK2DNYCUMZ4OALSvJq4rkuKtWxL6hKQ==; 5:vJp/2e/UUlRsPRIBB74h5cZXCrGMeAvHxFqZWncGA9GrifGsrhksly2+K004DQbqaFsUGX5x4LxIPJSeKfWPUnqioZ2H2iQrJygwQ3GH7KEIzpESghgp0a/zbGJ45XEqx3xIdXODD2jTBSVSZz41IL75GeEDKTTEopFco9Wdhrg=; 7:vwyAu8zuNTJ0YzmSCC2AjNnmA1dc6Jb6D+WPKpaDPLZEuw3YDUKfNsqzctWKpfMqOA4VFPa4wb1cWXK+rpC0pv1Tw8JAoUWQwo9inZNZijarVwMo8JTuk5wmhj0eGrYnCciHpk7QfqB0hqPKwwRI3jzaXrX2Wzt/u+/9SoaJK/H9cdYugA4Cu4s5kwwMg4nhUI3GDgUJDsvydOXsZss6adlzLqEvtWcNEd6V5FDcLj4GOGFC7MxMoGvSxtk09XA2 x-ms-office365-filtering-correlation-id: e92ab35b-132d-4059-1cc2-08d62ecb6a4e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0502MB3790; x-ms-traffictypediagnostic: VI1PR0502MB3790: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(211171220733660); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231355)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991055); SRVR:VI1PR0502MB3790; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0502MB3790; x-forefront-prvs: 08213D42D3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(376002)(136003)(39860400002)(366004)(199004)(189003)(305945005)(5250100002)(86362001)(52116002)(575784001)(8936002)(6436002)(6506007)(386003)(102836004)(316002)(6116002)(486006)(2616005)(66066001)(99286004)(446003)(476003)(6486002)(3846002)(5640700003)(2501003)(68736007)(11346002)(4326008)(14454004)(106356001)(25786009)(6916009)(105586002)(2906002)(6512007)(54906003)(76176011)(478600001)(81166006)(8676002)(81156014)(36756003)(5660300001)(2900100001)(97736004)(7736002)(186003)(71200400001)(26005)(71190400001)(53936002)(256004)(2351001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB3790; H:VI1PR0502MB3743.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: fwa8t4YOsFdasT6pipoYnSZID06nBoALuK07YF8w7ImAU8WUumOoKX98WO1gr2EFOLTTnUxxIZr/HLe0Mk7RQ/oZehnxvDEZLwhdZIThj7Bg8marTIsIF5B4WK32i9E0XlWfw8aSDeQ6qREe5LgjD8mxTF30fI7dEqQEwmN8ct6dGJD9d1Z9g8fRA4eb4uXR5nypcWsgnNCR7kRWL2LaXlO++WLbxGnllATVjB+/HrEkB5uxB0fh8ygeXiW8mMPI1Ov2BPoKRMaM4wlbMirD/Ak22kiT24PLeIofGKXEzqgd8HDaTs0lkDdJ0VEFzNPUZKaRju/xJn6DE+PsKufboE4+U0w3zW6o6G1I/BHiW1I= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e92ab35b-132d-4059-1cc2-08d62ecb6a4e X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Oct 2018 16:14:11.9059 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB3790 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Shahaf Shuler , Asaf Penso , Thomas Monjalon Subject: [ovs-dev] [dpdk-howl PATCH v5 2/2] netdev-dpdk: Set scatter based on capabilities X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Before this commit setting scatter offload was based on checking net_nfp device. Since DPDK 17.11 more PMD drivers are reporting offload capabilities. Therefore this commit removes the specific check against net_nfp device and replaces it with a generic check of device capabilities before setting the scatter offload. Signed-off-by: Ophir Munk Acked-by: Eelco Chaudron --- v1-v4 This patch was not included in version v1-v4 of the series v5 Initial version lib/netdev-dpdk.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 4dd0ec3..ecca276 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -367,6 +367,7 @@ struct ingress_policer { enum dpdk_hw_ol_features { NETDEV_RX_CHECKSUM_OFFLOAD = 1 << 0, NETDEV_RX_HW_CRC_STRIP = 1 << 1, + NETDEV_RX_HW_SCATTER = 1 << 2 }; /* @@ -894,13 +895,11 @@ dpdk_eth_dev_port_config(struct netdev_dpdk *dev, int n_rxq, int n_txq) rte_eth_dev_info_get(dev->port_id, &info); /* As of DPDK 17.11.1 a few PMDs require to explicitly enable - * scatter to support jumbo RX. Checking the offload capabilities - * is not an option as PMDs are not required yet to report - * them. The only reliable info is the driver name and knowledge - * (testing or code review). Listing all such PMDs feels harder - * than highlighting the one known not to need scatter */ + * scatter to support jumbo RX. + * Setting scatter for the device is done after checking for + * scatter support in the device capabilites. */ if (dev->mtu > ETHER_MTU) { - if (strncmp(info.driver_name, "net_nfp", 7)) { + if (dev->hw_ol_features & NETDEV_RX_HW_SCATTER) { conf.rxmode.offloads |= DEV_RX_OFFLOAD_SCATTER; } } @@ -1035,6 +1034,13 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) dev->hw_ol_features |= NETDEV_RX_CHECKSUM_OFFLOAD; } + if (info.rx_offload_capa & DEV_RX_OFFLOAD_SCATTER) { + dev->hw_ol_features |= NETDEV_RX_HW_SCATTER; + } else { + /* Do not warn on lack of scatter support */ + dev->hw_ol_features &= ~NETDEV_RX_HW_SCATTER; + } + n_rxq = MIN(info.max_rx_queues, dev->up.n_rxq); n_txq = MIN(info.max_tx_queues, dev->up.n_txq);