From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0064.outbound.protection.outlook.com [207.46.100.64]) by dpdk.org (Postfix) with ESMTP id 0D88D5A35 for ; Sat, 7 May 2016 17:18:31 +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=7H3kTO6Njk6HdxDkoONR6NAcpuJ77tb8xmgnip+maYM=; b=RxaNssEzgej2Q+VQdWiUgFJxXwWNG4K/GX0obXkB/gL0G75+cYtk4ZmqfSZHUW6ZDK9zWSi6XI3L3i/9MNpzutqZzzxHBYef+yRUQy5MlXs9McOZFSFOnOtQ43oJqRY2fpciImrgTmjxPNndHo/6XazLJWaC9GWNzXz08ViM3xc= 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.10.92) by BN3PR0701MB1718.namprd07.prod.outlook.com (10.163.39.17) with Microsoft SMTP Server (TLS) id 15.1.492.11; Sat, 7 May 2016 15:18:25 +0000 From: Jerin Jacob To: CC: , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Sat, 7 May 2016 20:46:28 +0530 Message-ID: <1462634198-2289-11-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.1.0 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.10.92] X-ClientProxiedBy: PN1PR01CA0050.INDPRD01.PROD.OUTLOOK.COM (10.164.136.150) To BN3PR0701MB1718.namprd07.prod.outlook.com (10.163.39.17) X-MS-Office365-Filtering-Correlation-Id: c4cc1028-64b8-4a15-ce6d-08d3768ad87c X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 2:EtgeQT2FHiVNpt394CQVd8n2XOa+AkHsxhAqecjlOJlKYrdQQYjXkFfADHAPOzUM148f86nrQbGWToK3PTAI/0AyHaV6tJKU7KP1YhtH/KO9H0eMIm/oaX3tsBdqw/nc+s+89eWSR+R/4WD/5h0HT/Gw5R8J0PRPgHvWj3IxgALI7n7rfsHws8QZeapzpFl6; 3:t9R3/GXcTowq0lvFOg7A/lK/nnIOq1+0WXXL2iRSLuAdP0yy9oF6sgU5n60f+WB/xL4t428CpjnOBXqIscXO3BD4c19WivnQklHvUfCIOSzWL3OmKBKnBMjLSIEXAn2K; 25:14pN5ZP+VlP7QxSGalQJr0x3XpgSBYK+wg/d1KH2fLu/TMzQYVLq2D1v74YaQWHd1bwNdA5qY5SqiDuRh3lFAbWPjC5grkro5/hG3dsYMcgwvACvblDLQfwvCXbSDFm9jYDVMeRYR7Nw3qL1+v+RUY7fd4JKZ2P58CW3ahbM23/FhlhEeZRUBif4p7qhKVP/5dT0dA2dhDBXChFikwsg4oHo3roqsJj0AQpybesiNZXJQnvCdlAZ53SLnAyL+VRXM+ofAWpcPYZHMXyxASjYP+XCFFMHyACeMK+/6ak05q0LzRAVld5OUeveADBp6E46NBQhU033NLGoHZ8AhCn0lddCpl/FCSKSXE9ajDurbrh/6U5Yg4RobTgZLYWLQDQftn5jwwn03/fnKlqyVjJ8xw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0701MB1718; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 20:EyqUwEYe0HwcGB22NlCHC7ZqbxCzWD9u5QOAzW/Sw0qnSpn3DyZJeaaJgUyUKQwdME/+OlM2F2QAeHUx6C2zls9ME+UOa1iZtkRcHw6hUwJ+YF7Mi7ze4Gt7D4o/kMkg3haIC+0QjtplBrjM/UKXbajqOP7HYKnMHLR7/JIye1sNczbKteuvQ41DL0lZqWoOCUZQKqd2xx/FfTLPRNOY6wvrBJ6HawIhjD3v4G3hrk0OoSIg/cZWHfWhgLR4edNtpNJVtmP8U1DutgIFie8OWfj+jUPCShg5UM5DYouo1LJumTGBFR+tIpR7RvyDT3QFGkBeTYkgwoG4I1LYZMiTPwRrOcRhFL7b7CaK7BxOrwJEgsoJrJgtjjceyFNRFSgkDBvFjdi1D2U2IHOCPmKd/OPjihOw3Y/9+wosF1BzVv5YlvZ3bssVB6G8pQxobwCgXD7JIi+rB1P91I5GEi+0/7HxXa3UZk1gOb1jfSyUS7UiOKlNFWx4RhqLakrcmcv593sYGBAp/xyVaqfHjcOluml7N8lnnpfj0Zwn6Hk3Mq0u1CvD1FQdBfvie2mx6zub9H8emc/8HpbWnSpP63tUqKy0u3y0fVNV1Fc7xLfg4NU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:BN3PR0701MB1718; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1718; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 4:uDjXWrbhtJqSAMnd85qegV+rE6pLHMX/gjXFwD9TiEZKUUsafqVXBJoVgjpq9g31KimSq2IUa/Ag5AN2Zz3AEXUJxWcX1GJjJnQNt+bHujrkqc0nVlgK2bFmaXQQKsUR52T78SwmeJLbbs5aw9wpWTJY+ZTsL4uy4J0Rm2rUrxKdHGDzVbafxEf3T69MXIIqfL6ZeYb4TAbSSiFSNhCoWnNGXU2SG/NMaY6OTEJ9tDU+Dw8YRZ6BRhM1q8MWYra3/HnONxE08NxQ3HEOIZxe1BwQqCGw2dZ0sV8k/8FbKukMFbMQtwBpOjhDLqa4PxJi5K+bgu3YtSFmC1th69D5ykgMltjPcumhfpG/g1kW86glh0log6ocuGIHGOpIXQWk X-Forefront-PRVS: 09352FD734 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(50226002)(77096005)(2950100001)(48376002)(81166005)(50466002)(66066001)(47776003)(92566002)(5003940100001)(4326007)(2906002)(110136002)(50986999)(2351001)(33646002)(586003)(3846002)(6116002)(229853001)(5004730100002)(76176999)(19580395003)(19580405001)(189998001)(5008740100001)(42186005)(36756003)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1718; H:localhost.localdomain.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 23:+rf54lON4DFatJYidLea5FX3kOfi+nw4LPjgPZ+xHEgM90Z6CRFf79Yasf8EwI1sxtcOeh9+TYie0VKAy26+QlC0Re20y3N3/dSD4fpkpZEXhNKAPdFtjusazkrlrr+NDebni+w6y6HmwhtZzG2h9InMi8SyC38RESs8lItiHNllEI2HkG+PAwBzG/0xcPLKkuSvAOi4re4RYRDjfcqJW8Cb7bUN60xj7YXpCp2LDfxA3Aly0M+uFZpub75r7wXfcOZnvcApJy4T7Gw7q/wmyE6Dlq+UTvcfJ7XULd/dHaeVhue0cVyN5U6uJ16QPqOCK1jRNQRYYJbryI1zBGmtOyUMzNhXLlUYjZUgwWhFCx+V/fgrGxAdkFmEemamOivqJZ83CmbSuqvXeWchGxp/oX/GrxxyCJaC+zLD8HMAQen4RmoBYhXhnXXhZnW+SfTPIc4zN4Ddbj9ZYhG+10Xcx+qRepwCbzTrDS6KQFVYLJCc7QAwHgJdlEbVqatv0oNio9nKidMubTUOcTuKXMHvzjz5hsb1Jmepcy7g7PJaU6XJZ5/PjK5qbwGlpwHbw3uKw3C7XTNHSqxNeeevHZcKpvs9asv6N7QVMZFFcmq9RbotqF8PRxpem11tcIEZwoEorvzkk6vzCRXD9ZIwW/vaTiND7CnZm5od2pZI0T7mGAqsQBEs17UOrg8KarJfvE91AH+RhpRsAhBNsbX+3/4CKw3mT23frGIH0hYuGaWmhU4qQlrL43XfqpF8TVMw99Ob0Ra7t4leNF42XIYJGAvbPDhijnLGRxeUbR4YVQjP9jFOoIb6bimZtcOqqrV/054SCSjpWiNxmA6ETJ/PuYeRuVRF7Wvp2pm4mcRkUYiVIvZ3XtguPY5HjYSCrkrBVtjd X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 5:4BSwKmDKJHbU+Oj5CPfXRqeN5i/7t8SKrYLkAW8y3Uy8B2X1g2OdyKRtVvzsr7wwDkGB7TkSBceA8XyjBJMB0omSzPeUSycBmCdV44phIPtZs8z0ggz9MqN3pY9RyNoauhoj7uZ7uWPChPDbckP+Pw==; 24:ypld9RgSxDPpHGk182EQglglFpxSW7hk3N6FMkccvTPCEFBLI3pZmKctPsdMMHOgxEvkXfT8ieRE4xdrBW2EZ5bMwby52pOUEn6g1DGK1m0=; 7:7XyQbdPYNY/TGuRCfPCLsx5ywTe3nVupEpmXt4XntPFzc/cSgla7MdyzIItqgzdaHev1gp04NeI/77J3Yb06xtRNGatDJ8p2TxkH4BAaRBbmWSEYDBJ/yPs//ngbvQ0OextO7Htrp/A23M5ZjwuLJ5a58BfIjcFfTBnpPSExOh/2DY+lm477IhBvkgejnEKP SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2016 15:18:25.7117 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1718 Subject: [dpdk-dev] [PATCH 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: Sat, 07 May 2016 15:18:31 -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 2f4b08e..b1a0077 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 8ffea8d..5937b45 100644 --- a/drivers/net/thunderx/nicvf_ethdev.h +++ b/drivers/net/thunderx/nicvf_ethdev.h @@ -63,6 +63,8 @@ #define MAX_RX_FREE_THRESH 1024 #define 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.1.0