From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0058.outbound.protection.outlook.com [207.46.100.58]) by dpdk.org (Postfix) with ESMTP id E4C769ACF for ; Tue, 14 Jun 2016 21:08:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wh50u0bmwnlshJAOiw9JqXOKbP+xUZAvRg30UMl0B28=; b=TacQUCYrSIUwbyF85uHhjPLr+TlGvxoH649hMXUDyNfl25zusDl69ukm+5z8Je3XjBnjDCKfj+JcHNiBNWvKew8ANK6eHNIcDVf2Y2x1eShfspHd8Ygb2npY6lXdDia1w71Y7EppHzDrRj8y+SZxrlHSitLl9aDv8EI3lCdCJ70= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) with Microsoft SMTP Server (TLS) id 15.1.511.8; Tue, 14 Jun 2016 19:08:07 +0000 From: Jerin Jacob To: CC: , , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Wed, 15 Jun 2016 00:36:31 +0530 Message-ID: <1465931200-23912-17-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465931200-23912-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1465826143-22159-1-git-send-email-jerin.jacob@caviumnetworks.com> <1465931200-23912-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0040.INDPRD01.PROD.OUTLOOK.COM (10.164.116.140) To BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) X-MS-Office365-Filtering-Correlation-Id: d0fe39b1-2d3f-4274-7a67-08d394873a1e X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 2:kyMKDcQFRZnpZCXymLMx6TcMTZ+VHG9Afp12bQU+fCwOP6/kYjb32XUxWkUFcBZJoi3rMCP8rJbb690+s08kYifNk8F5bCGTfcvHkY9AkHaCKfzarrDeWWgc0Sw9AkJa504JTzj7ksRcf796vkm+q+3b9UmUUXDStCv+cG71dbCwzfhEe/FezZMIpgExO2mf; 3:+SHdwDtE5Fz+6PPmsOIkL72+9wx3g7jTqns1OFuct/vxfcwjJFybLejmLzF4b59A06TO6HnvDRIYztepXaCtjThV+ZAauzYlYZXyOrVraTyy+Z3xR+w+Jt22fU8YaBFb X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 25:4mMlOYQnbFCO3SCIXoR8Vq+sp+6yhNUiYbpHHwH8kluDIK1wE4phjyLXC/8sihIDSwjprmzndlh1OHMw79tKcAbVT8XU5WXkMFfb7Q4yIbGfoyqt+Wdr4LyAQmj35Rlza+PEtdi4q921MCX2XItsrxLiuKYJ0fiv9Z/umjXadLNDEGRIrXgkOKz8Vc9PttqiEqYOBH16+ZAp5VMy9YSHqjDF+VFjM7OUkMyJdYgBjWMW/1QXe8jAEsrLdE+nI0C4dntkSMYFYCBgCgPiI9JnRf+DXbL4BFx7hrPS3GlU7S8PU96EpKR83kKtdaeNTdAd2zzP7q2JGE+HTiY3/TNUjflaIgf9uozAUOSBm8mCPyY/gyCBIbW/qHUr2PLyyDzB8MT4X7w9/NrCWMtv8zdJyJZdFwg0HY/rDgvVpC5NRD6kyPVoekzCFbDupSJ52yDoQh1APpD3bYaltSrzqFKl2NnkGczl8+Wkn2H3kz5MwYucH8zXGhwF93iT/5h+5r2svX1TSoydEXhz57Oi5l/adFW5EvSqMVmEzC9YMq/Yptrg9aIoqEy9asue5leCMRTHDiQJGwdrHy2rcT1WJSNgzbhs5kctooL8Xh2zxnc/8e/unUedlwHJSdxd2jZ2CGdK+3VhwzWXOS5PfBVWhpQ6LTc0XR49VT/7UF7+RzUZSFnZmaOzGupmF+IcKvNxp7+3CR6saOlqGWcu0Klu2Un3h+tgg9DU9y3ioea5JqTQUUY8ku4FOKcpBJN3p0mBTEhTNvNZdy8O+1Fx34yD7TeZEg== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 20:AVkJB2bjLoYfFigtOQVWbEgq6Tc3vLTb4Cs8r9UEBPi0ZQez7MmwB+H6mUlTzuG0EvlC0WjgGxw2cW8Up1BXC0dRzRlj+QrC9yPuv7ArPmf+sX7H+QMZfJJyHdbX/dbLQ54PT1vPhZZxuKaxPFvnFuGOvrSwJpuLImfwFAPzsQQ5jA37ErgrtZtmBxj0Y4h8NIJDkICbzaRin3kAX1Ndw3nun/MzXyuTIDSAAQ0nkvCU5Y4OImvE9Z9FJ2/S3XTIy5U9hV8bJEXZoJQ+VB4uyirumtAw09E3GIicfdbTXHUmuvtIi1EOhLqZqO9O+EuzCalsU9165NNyIY/5NsR3KJSypetwQ96iI4195W7kvMOiWatA+hfVO3j7q+P/jWbnSYAC853Zl1jIswd0vM+iBSgVOxzDN7a4r/eO7HnTLl8UHn8a6dhLdOaK+9kIZrK4DR9iv+aPkQk2Eh3fyETMqXkscx/ydTX+Z+v6DOvvsNRUcnGY8J2XIcOvMTs2CwImAafwc+dv4+mRYxiVmrB2H1+jthxEDeLQ8wb6uLgm4QqZVfm2c0W9/nnquTTG9TBVntHrYJJBF4sUXY/LFQ8zsh3KjQRgd1MBMkPQUFuvsGY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:BY1PR0701MB1723; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 4:pwnnjzGWaSNFiOIDobHoQ/BBieK5mo7g75CQERoQTd36M/1Ky2Af6En+IP1tu4WEtfAcA3WBjbndxRDIBsUe+edmOkuBc3Lg/y2ozf2vAQuNA+mrEaUe4Sj8qe4/gt6w31WQ+AVGQY78aTC6S4sjMJKVfH7iE64wQxynTZrYkHVihb+ofqyh5jsx+7pSNrqpvw5ED1L8pJVHrOAUsZGmFgzQ+ABUVAknF+J+Ts6GMhuthceidxMsblVynx4iH5+KyYdjPuz3DeAWSjP33swHim9i6+iaFW5kLFIwP1hbDC50RtgV9jgUaOVdpLqUxnwtkGtuMw1R3Sr7wBdavAJPyidcMZ4WfwuzVYa1fSYlmGSkF61BkRVOsxRQ09tKXFu2lh7FLWtQAHGI8NEb4BfmX++DNXJk0Tcj4uawPJ1onw8= X-Forefront-PRVS: 09730BD177 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(979002)(6069001)(6009001)(7916002)(189002)(199003)(69596002)(189998001)(2950100001)(48376002)(77096005)(36756003)(19580405001)(5004730100002)(19580395003)(76176999)(5009440100003)(50986999)(97736004)(5003940100001)(68736007)(110136002)(92566002)(101416001)(5008740100001)(81166006)(8676002)(229853001)(81156014)(66066001)(4326007)(50466002)(2906002)(105586002)(106356001)(2351001)(47776003)(53416004)(76506005)(42186005)(575784001)(33646002)(586003)(3846002)(6116002)(50226002)(7099028)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1723; H:localhost.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1723; 23:0oXmqvXdbeTgSvhWYjef5+NdeRouV2+8bURfQlk?= =?us-ascii?Q?ny2wU8FbOAYu8SZ5VfSw6N4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ii?Q?/X0Dc3s9H75DYDpV4rpMCiGonYXM921uRHF1WhrXWjKi9elbT+n083cqh/xq?= =?us-ascii?Q?edXup0SyltEBeFguLMRbIct/ur1Zjg2ePnuWJxYWCPufQvE2z1Ngpy+EF2g+?= =?us-ascii?Q?ZVs5mIlw+g8UQ0tXnvQ58APJ47+3cdGzfc5+7zYZCnnjidKsHbOmxHQarWXk?= =?us-ascii?Q?T8TEvn155hLSW/e4F1abPmNQ8NMNMsd0kwzp74tBafYPZja1GUMv+BXrWHkt?= =?us-ascii?Q?ffS2AqhZYjRL8O1SpXB++GLR4H6f+MpRLt+zDR4hnmwUB6dZSrnnP1m9cBwz?= =?us-ascii?Q?xjI637Z+iNj3KCGOL3oeTqemKff4DQ2TbXMmnIDDwqhSFZjfzcFSttcblSXA?= =?us-ascii?Q?6f71oWLsSXBIFXEHkg+5mPys=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 5:16FOTrnH9Zz78dGSXDTm17qf2oSFBEKiFlIhYqewi7zVqvOEFhUZrezdUh1WugsO1hxOF91w44Ts14CDocP/J35pjjaGhX44po+Fali4zCiCoi9PX4Ul4edg/FqlhoXj5BLg0nju/rKg/AIk+9/c4A==; 24:mUvjHvJFySC1Woat0IHeaUdxuAASiqg8mwIfp5IbcTm8me0qv58btTPz2412ePrNeFgGEJws7tmjDxaf2EDD4lbmGn3COheCurSp8heABPY=; 7:dJ57ilq4yU5CmhRFpTEYyFCPR1E2nB/CjBTGi/G0nb2VDN0U6XtESmyC28Go/H9t5F/LNo9RQKT+j8Lym3pg2xECjGObYSmgQmxqHKRP8y/yK5wzTq0L6fJoX5HhBesxB3pxR3ye5kQOBLcW83CJNbptsy8hsUIleHnzmJD+cEap3mUF/QWQqn6Fj0G7F2hn8lyyU57u7CO0z4+NWeyOsQ== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2016 19:08:07.9380 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1723 Subject: [dpdk-dev] [PATCH v5 16/25] net/thunderx: add MTU set and promiscuous enable support 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: Tue, 14 Jun 2016 19:08:12 -0000 Signed-off-by: Jerin Jacob Signed-off-by: Maciej Czekaj Signed-off-by: Kamil Rytarowski Signed-off-by: Zyta Szpak Signed-off-by: Slawomir Rosek Signed-off-by: Radoslaw Biernacki Reviewed-by: Ferruh Yigit --- drivers/net/thunderx/nicvf_ethdev.c | 51 +++++++++++++++++++++++++++++++++++++ drivers/net/thunderx/nicvf_ethdev.h | 2 ++ 2 files changed, 53 insertions(+) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 1d5bea7..f0e3371 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -144,6 +144,49 @@ nicvf_dev_link_update(struct rte_eth_dev *dev, } static int +nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) +{ + struct nicvf *nic = nicvf_pmd_priv(dev); + uint32_t buffsz, frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + + PMD_INIT_FUNC_TRACE(); + + if (frame_size > NIC_HW_MAX_FRS) + return -EINVAL; + + if (frame_size < NIC_HW_MIN_FRS) + return -EINVAL; + + buffsz = dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM; + + /* + * Refuse mtu that requires the support of scattered packets + * when this feature has not been enabled before. + */ + if (!dev->data->scattered_rx && + (frame_size + 2 * VLAN_TAG_SIZE > buffsz)) + return -EINVAL; + + /* check * >= max_frame */ + if (dev->data->scattered_rx && + (frame_size + 2 * VLAN_TAG_SIZE > buffsz * NIC_HW_MAX_SEGS)) + return -EINVAL; + + if (frame_size > ETHER_MAX_LEN) + dev->data->dev_conf.rxmode.jumbo_frame = 1; + else + dev->data->dev_conf.rxmode.jumbo_frame = 0; + + if (nicvf_mbox_update_hw_max_frs(nic, frame_size)) + return -EINVAL; + + /* Update max frame size */ + dev->data->dev_conf.rxmode.max_rx_pkt_len = (uint32_t)frame_size; + nic->mtu = mtu; + return 0; +} + +static int nicvf_dev_get_reg_length(struct rte_eth_dev *dev __rte_unused) { return nicvf_reg_get_count(); @@ -168,6 +211,12 @@ nicvf_dev_get_regs(struct rte_eth_dev *dev, struct rte_dev_reg_info *regs) return -ENOTSUP; } +/* Promiscuous mode enabled by default in LMAC to VF 1:1 map configuration */ +static void +nicvf_dev_promisc_enable(struct rte_eth_dev *dev __rte_unused) +{ +} + static inline uint64_t nicvf_rss_ethdev_to_nic(struct nicvf *nic, uint64_t ethdev_rss) { @@ -768,7 +817,9 @@ nicvf_dev_configure(struct rte_eth_dev *dev) static const struct eth_dev_ops nicvf_eth_dev_ops = { .dev_configure = nicvf_dev_configure, .link_update = nicvf_dev_link_update, + .promiscuous_enable = nicvf_dev_promisc_enable, .dev_infos_get = nicvf_dev_info_get, + .mtu_set = nicvf_dev_set_mtu, .reta_update = nicvf_dev_reta_update, .reta_query = nicvf_dev_reta_query, .rss_hash_update = nicvf_dev_rss_hash_update, diff --git a/drivers/net/thunderx/nicvf_ethdev.h b/drivers/net/thunderx/nicvf_ethdev.h index afb875a..b1af468 100644 --- a/drivers/net/thunderx/nicvf_ethdev.h +++ b/drivers/net/thunderx/nicvf_ethdev.h @@ -62,6 +62,8 @@ #define NICVF_MAX_RX_FREE_THRESH 1024 #define NICVF_MAX_TX_FREE_THRESH 1024 +#define VLAN_TAG_SIZE 4 /* 802.3ac tag */ + static inline struct nicvf * nicvf_pmd_priv(struct rte_eth_dev *eth_dev) { -- 2.5.5