From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-eopbgr680087.outbound.protection.outlook.com [40.107.68.87]) by dpdk.org (Postfix) with ESMTP id 9D440591F for ; Mon, 13 Jun 2016 15:57:23 +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=c/UZi9OxLXR/HAx+9TCbFIbJSn57wgHZaoA6ZC4J6nyS9CEKqG367nBxw2ZZRsxG7v9JUcfqt6NdXSpj5n8H71TEesUc9N0XzuU+icmiZ59oGLVnJa7lPQ6m+TzLsjwd7++8LRiH4jEzzWhQR2eQwRkW713IE6bwIh2fwT/LeYc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain.localdomain (171.48.21.3) by BN3PR0701MB1717.namprd07.prod.outlook.com (10.163.39.16) with Microsoft SMTP Server (TLS) id 15.1.517.8; Mon, 13 Jun 2016 13:57:18 +0000 From: Jerin Jacob To: CC: , , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Mon, 13 Jun 2016 19:25:34 +0530 Message-ID: <1465826143-22159-11-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465826143-22159-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1465317632-11471-2-git-send-email-jerin.jacob@caviumnetworks.com> <1465826143-22159-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [171.48.21.3] X-ClientProxiedBy: BM1PR01CA0031.INDPRD01.PROD.OUTLOOK.COM (10.163.198.166) To BN3PR0701MB1717.namprd07.prod.outlook.com (10.163.39.16) X-MS-Office365-Filtering-Correlation-Id: 822315ce-0d0c-4e8e-d7ad-08d39392a444 X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 2:2yH11/R8NErU3eCz5e9zW31yDZ8VJXFJVk2hc4jAvxM1Zn9i6j/5ErAG67zijJJO0TZ29iWrs2syDXqujuEWUEohnJTQLrHhK1qaUR3YmqWY/dFQOK9E9mQnyUE7BPH+AwnMz1A1UrUJTIT9DsYDDNTalQeW4SOmrv5Wa+tF1yos5NnjXbhKtDxMFbJ+AL7S; 3:UFOY/xHH9zvDw52xVWkJvH3eeRRK5j7ljYhfOL68tTry4+ak4D7HjdNwOa5jezdamdRA6wrS4ZbOd6g5MhfEd9XYZ3s7g8fVw4DSI05j1ScqsOh4+yx0Qa1yQh4aBXXA X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0701MB1717; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 25:8KB56c8IaYsHXKXU2OVsdUAT4MiuwDVPnXDd02Jw+c+yGas0Gi7AnX3N+LvrpbVrzzlyvuwftC9I91V6SpZIP72bJ4d7yzXMc/oXSbI628mv7DmJ1iIVyPR/kyCsmKTzJtfSsGY2jrqxOPnKDWX/wiJLIpbs76r9hyG6fAwOIDTbHrMaQ5bTFx6o0TiGkUsqPQV8mWsWo3nNmhu0znpiZ3sEpu2lqJnoZZ1wySjJcSNQ2aBGHCUnhDUfgMJTtd2WPLQBZ3dtkJXhXLqnejJFKfNZs942+CD+Zau42WK/mHCaqFh742GIvBlGnOyCtgg+o97J9pYfeMPVueH0sJQEVyZeaGjK4uUALR1shHkqREpvZIjrOegvwcFSXdTFdPGLWz65NE1nxHyeTVGHk4aaffaUHUCeN3vCAemniqIYS+t6k9URLNsjFB5N3z8WO2doCQ6DFRGd1tPwUCPqiaz54pQ+qXdy3gzfDsMw4vsgcF832fRui4PXXea1dx/Pb8ohxBvh8SkBCaxNNtWFNO90loVrMDdL/v4Bgn/RoVHyiar36tNy+dDTlC21m3Yav8uiTNHYRxbrHN2FIUS8DeCvRp2POCSCv0yPYSs2LWf3i/zKY4KN2OktRekwxXbsu0ejuC3Ui1TrZDW4BoqUleJwC+9k8c/XLzBmbsTI7aA35omfBe49QSy4CoMN/wa6tFLyiAjZbMn+O/Qj+kKfWjhAYl4u4XZCKqwXQPEwgjHIdNYPfVAYpW3rEA3xUazfzQWMjD5YW+45VlB9MOEf2X2GyQ== X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 20:jzWApJY7znjPNcfyQF9SV3cNEUK0WqS/GKXU0pv7wvLef0JqHrgJOFGHFiSMh8VJnWzKbXQoek0jHKgks8Mvncl1614C3drsOh0fM20nXynr5eT0iKAjCUfD9webeJR0jSAvebIL5b8ALhE6+69mND7+Kd+xqfGodjw6sOjxBk4HeOxzxv/3vvmp0tI8SqlgmgNbVwuJP9WRjnKZc4RIvsjbSYcqrwAn1lo8Ad/KbJK2DqY141+7/xWkkooOPqIripqxnpy8w279BENkOmLw+hBNyvjew9ft7kPx/SfmzNfupqIK4kdh6lKLE92ub+yeaK/UV3Dkuj9CqW9R/Br6yoKNMWfpmEkn2EUfkd/FwUd9zZcUje2LxRqccrP5KEQXMLaiPCm1docTm30CtZYeTqaSq+2jwFGdyD/6eTtCgqER9uHk9YkNcMWmgbxuT7zmhnbb86CwO3Eyjq0G1PcoLvSX2q5F2WhUiLZpI5KeRKgE+42uUa8IxFtAjeXWmSnDgvIgLkHtQROyqBCWJb2cmcUmbu5O8NlIImSFWrGHz+YjqxF8Zk3ntS1Cx1Z/CUY4jSQe+iWZdK2LACf/PohK8QppCF/XiD0OEdrd2XaQc40= 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:BN3PR0701MB1717; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1717; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 4:28j+UBtv5f2XBs+fd6rK3BXhnrx4P5bWReXgqKYXxylIFbAgUGr9E2Ebvt4hC63yDMXbfqZcES7nHT+h+3wdREH5ENxwMlsaFSOyPyJY5LYKRHVm57DeLD+PF2YC2cBTg7wTqYmcSR25gqUv1b0+u6FPOqzGQpauGl9ZZ/ymFj1j+Exbxx9pqaYp8SvUCHycwDlEDHcciCUjsYTTlfrP113SrGJscktSyoNrPcK3bM10/DntcWgxNjm5+d4+2G5cZG3QoXset5Z6NAbhtySKfkQcg5PcYh2QjkTR8aUpP/FZXBDNfbLnVdRvzzItqqIHQjNmQUeOA+opVJWLPmoQuTL4b7B7PGUshDfGS1tHZGVrT4XBCcefv2r1gV1VoPpcfXy8ljMPmMQR7QcmxVAhl3DOXNOyeMvIHediexWZcyk= X-Forefront-PRVS: 0972DEC1D9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(189002)(199003)(50466002)(48376002)(101416001)(42186005)(50986999)(92566002)(76176999)(105586002)(106356001)(33646002)(2351001)(5004730100002)(47776003)(66066001)(36756003)(586003)(3846002)(6116002)(19580405001)(19580395003)(575784001)(77096005)(8676002)(2906002)(81156014)(81166006)(4326007)(189998001)(97736004)(2950100001)(110136002)(5008740100001)(229853001)(5003940100001)(50226002)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1717; H:localhost.localdomain.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; CAT:NONE; LANG:en; CAT:NONE; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0701MB1717; 23:2h2JgpBL9gs6xPHaIGJzKD8bB1auVf8WZhr1EBj?= =?us-ascii?Q?WdD7aAwETeVdprSCpjuYTFtvf7gjkrpInQ6FVCc73dIkZMKzN8fP5Dyi3/NR?=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-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2016 13:57:18.1774 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1717 Subject: [dpdk-dev] [PATCH v4 10/19] 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: Mon, 13 Jun 2016 13:57:24 -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