From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0053.outbound.protection.outlook.com [157.56.111.53]) by dpdk.org (Postfix) with ESMTP id 0CF7B2BF4 for ; Sun, 29 May 2016 18:53:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=TYi9EmujFe14XldTz4uHH+XNA+bmkojHjyxu1HQ2FgA=; b=ZVF49ESmPnshJdhWLIoOJRRd4PUZiAsQlXcB7H/QPy2zrj05DHn+nRsMm1q961S6TwnAnhfIy46koY9HZeBdp6dY8Ku0o2rO8KeLvEPA+Q7vqjMzsklrN5TIoPGXHcuFKt8aG+hpppCDhChDi72hrP5cixbWRTsbYQL5j+ZivVU= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain.localdomain (122.167.187.184) by CY1PR0701MB1727.namprd07.prod.outlook.com (10.163.21.141) with Microsoft SMTP Server (TLS) id 15.1.506.9; Sun, 29 May 2016 16:53:33 +0000 From: Jerin Jacob To: CC: , , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Sun, 29 May 2016 22:23:05 +0530 Message-ID: <1464540785-12971-1-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1462634198-2289-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1462634198-2289-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [122.167.187.184] X-ClientProxiedBy: PN1PR01CA0023.INDPRD01.PROD.OUTLOOK.COM (10.164.137.30) To CY1PR0701MB1727.namprd07.prod.outlook.com (10.163.21.141) X-MS-Office365-Filtering-Correlation-Id: b734ca03-b9e4-4056-172d-08d387e1c78d X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 2:NQlnUApCVERiYEzwvvsgkM2MNnJyI+843AoMYrwYkKHSD3TTOomBtyIvdxo2/7D6ftRk9bSgMWqLoRHWZmi5ad0yxc/xf24/2UQfnqZusFwUW+cXZl5hpRIPzsOic2fM1LAKnGBLo6CuQ8Tp4b2KdCUmL7GEtH553GPaoaVMcOp3GK3jPM8pq+WluRR1HWPz; 3:rNW0pTocSh6L+cXSSt4zNIWoit9wphzgjz4H9SA2GsE+Kzcd3Y6eiI8Zc1mB2j95aRRffZ/FgYxX0WMD1i+eLwN2uQ8lQYGtyZ1UWAQWPXPb96xciKycRUort9pRCBqf X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0701MB1727; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 25:fqXmI6L5LQoNgURCNCjUFJ58scltyYBGAijqprXBPSVfme7HitVh7aozZrjevF9sJxQ5sGYhsZBIO2M5fHyyeXlgupEMzFNiLbLBeg2WB82nirRR5/3IXKV2paVWyadwA1kFRXexILK8xGWuRigbiRj4MzRt8mSsMYQRm6L+Euzn4JXp9ySZ8OG2jmYgq/CqmMAvLXNGePAqrID41z69oy5XHtjwjAcjFU1cPs0nFTsGVXDeGs/YVK38h4q4KR1KysqQl9HaV9MVNOCbnOn79Y6L3hZheQLZS6FxIlkiyXrds3JQJJxml+UX1IlN51RjcWixktztQecGFHuptvIHI+/I0poC+ZhnJ3rBiToowM8L2BybUygwtWgSlr4cnUgoUUWo4rs42yjEatohLAFAeFk/UVIXZLGypd+l0id1s/zDD/Bj+4worgauDIk8tmlqrRgHpU3UhXSaxojnqR7kFjQE0Rz8crTn7NUpxd93lFWApNmwmF1nc5IWFchFE2KLb6nrjJZnzRGtFRNE00xYnYH4rRanAYZmh5PPmSdF7gutQgZGiNguOkZXiZnLRAUmK0Dm3MQN9KTOzMTL2KpF1LTK9lQwnlwXZiLOhIdSMSLIEmNGEKlCSYpDIj+j2zBCMP/sGbua9nSBHmDUyNLqXPYMjqhWxB6KD/clvElukV/xKkRNmBCS64JpuE/va6CfwCZgUfqcSpYg9uWDdU8cqLGarU42DyDEWyuide22+RZi2xPeLFK4hmZuMfDM20OS X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 20:larSf/HmpezbPN8Ziqyzc8DgtntX2t4JwvyIC2YidWYByY8aw6aFOKhly6ev1v8EaDad3EbAxw3i0PdCo9MoWOqsAHIL09KaCpnEPnV9jWIQx2hGQ8S8We9h8/G4+L+BSLJRh8Mq+ViTzTQeDiWm1w9p/ExMrmH43R0kTP/0qTQfwxQBc3bqSfqAd81Mti/n3DD5oijNfEIU+iB+lXHXLUn689mNhLAVwoBpWs21jtbZLmb8bFQfmPdM1Hjw9ABhNdwOZi+iL+IsWJA/sjlNsy3j5h2CPhNw3cWkqrqaNx9nALKP39lh0nARTMpA1+kn8dbH2SY7uD1Y8WEgdHoeaiPEo7Ef1jSCWM/34ni4TsXsey6KtXZVBS/Ve2JFJcKCMZPCL/c1N6MTlXkVVuRgzrOKWNbV0u87jFQg6NaMIBLAYmjKvguaGpuQWSrwGH2SmrlEDvqvW29DM9qf5oqZfpqAHkzfUG2DOZhFkfdxMnfbaS3JkZqSPISzOCWi7mDxetA1g8f0eN0rSpYJkB7dhH1PqJfl6Q9Ec84WFCXmZcO0SuOd/HXx+osmpGNEgNOHWyXe1TA8/9e410wxqUepK7dVCSTqGckRFnuCliTVdyI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:CY1PR0701MB1727; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0701MB1727; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 4:Xj4zbZpegiT1T3/0cB37Sv3e0i5+GVxNihJV19v7B+VcSw4wnn0em2qSnkPN/+Xnv/Furj9uY9PR5DODVL5rfnepe5Sx+MRzzUHQgJt9Mv/HnBzfD/pPLJxNgu45kJrtxNkeKx+vbG1ePgOYO2JIccZrYm3drbaBq73xbpZtZLfOV1iT6J+qGtpPlEdwtdqKqRPclhmJTZm1eUOzgPhf/CjS2q828pIQU/HE+JgU8jBnASPBYXBeKDuv19Dq1085y4aNsNxXtktHXd0fjp2d2D47SiCf6QHacfSfk6PYQo+Pu50yLveweM86msViBEsQkhX51qo7O3Uu0ayjQ0CQHnupubG5M1Kwh9G9JUKGp+Zx+NBjciiNaoPP4rgb0iv6 X-Forefront-PRVS: 0957AD37A0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(586003)(5003940100001)(33646002)(47776003)(92566002)(189998001)(66066001)(81166006)(4326007)(8676002)(2906002)(229853001)(2351001)(19580395003)(19580405001)(6116002)(77096005)(36756003)(5008740100001)(3846002)(5004730100002)(575784001)(50226002)(42186005)(76176999)(50986999)(50466002)(110136002)(2950100001)(48376002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0701MB1727; H:localhost.localdomain.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 23:Ut3SuG8nDsxitNRCzQOqMJcLv7r0bqOzNVYa6ZemG/64wjZ6wAZGD5A7185Prn9vJRNF+xnSE+5jTkDjZPJDgWs4/fW2QmarhZg54SXdE3bQHomRQt/hA4sILlkb7UY7Bwy+8nyWZRaVNCqlgzMvzKMBSYbR+x1IhSMuL0jvH4o7dJQ7M1gp3r5yXtY3RVAsYujRxQh1m2CBIotMPx/p/wsDgKlaqBizq8DEU8JYKJId6kK+ZCKPDBmsVDeqHcBWJH0HtuZko3hyIq/sUE0511jW8hziP2yK6aV7ghmCINyi9HJfzwr69h9fWTjy2cPTx7TnhaB+2GtLFud3239HXvk+SDURO/FZmeiqMtlEDf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1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2016 16:53:33.7798 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB1727 Subject: [dpdk-dev] [PATCH v2 10/20] thunderx/nicvf: 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: Sun, 29 May 2016 16:53:39 -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 --- drivers/net/thunderx/nicvf_ethdev.c | 53 +++++++++++++++++++++++++++++++++++++ drivers/net/thunderx/nicvf_ethdev.h | 2 ++ 2 files changed, 55 insertions(+) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 87286fe..b0f3f5d 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -71,8 +71,10 @@ static int nicvf_dev_configure(struct rte_eth_dev *dev); static int nicvf_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); +static void nicvf_dev_promisc_enable(struct rte_eth_dev *dev __rte_unused); static void nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); +static int nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu); static int nicvf_dev_reta_update(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size); @@ -193,6 +195,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(); @@ -217,6 +262,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) { @@ -817,7 +868,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