From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0091.outbound.protection.outlook.com [157.56.110.91]) by dpdk.org (Postfix) with ESMTP id 0A39FCF65 for ; Fri, 17 Jun 2016 15:32:04 +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=PsWJ5eVCVaZWSuXnwTQ9zZeiZE9d9xutR3MAYLGfKIc=; b=d1k07XOUl+PwuX45CF6K89S65JUFgsmazUttekT/4rTf9KLPlS780tCpkzEfHZ0Y89kWqeCpHpmyEHUKokr+x1srZCEOkwhSS0d4RgRsq2PMInc+sZr8+1Pz/3LPA5ADhdiaQ8oy26kK9AE1DR4TzIn2l3XeR2Bz4R23pa5bOSc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain.localdomain (171.48.17.70) by BN3PR0701MB1718.namprd07.prod.outlook.com (10.163.39.17) with Microsoft SMTP Server (TLS) id 15.1.517.8; Fri, 17 Jun 2016 13:31:58 +0000 From: Jerin Jacob To: CC: , , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Fri, 17 Jun 2016 18:59:43 +0530 Message-ID: <1466170194-28393-17-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1466170194-28393-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1465931200-23912-1-git-send-email-jerin.jacob@caviumnetworks.com> <1466170194-28393-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [171.48.17.70] X-ClientProxiedBy: BM1PR01CA0028.INDPRD01.PROD.OUTLOOK.COM (10.163.198.163) To BN3PR0701MB1718.namprd07.prod.outlook.com (10.163.39.17) X-MS-Office365-Filtering-Correlation-Id: a8dda2a2-cbf8-4113-14f6-08d396b3c469 X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 2:2S0QgDcJsOXksUCXZJVh5kRg4qPvsD9nqRa8SLPfY8weUKgTaZRWxK8J7QVnUagvOsfETl3i8ZvxBNzUnQo1fwnawBuuuDToTX9kaEI+fldM9LUnoTs9VQXptOqz441GQGYhmc4kbnvGf2yYUnFn2+khVUezHAvNoA+vfJ+N+ExUfwsc4awQOEy0K51JBl5a; 3:eM3TBC3ylcJS4yxCiCoFSXBJtJ5o7DasDh8tAwmFO9DJocjVia5Z5PR3zKsRi18+AA+CRbAKbkApIbl61I8OY1p5XNQmRPbVhdlNaTb2JNE+QSgpqsNpL6hNmx97rD5D X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0701MB1718; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 25:3UdNO30enwvygE4jC1NBTSZLmQBaVbXeZSXRZQldEbjlGhDV+r5WF5Hbh0x5ATpb99o8cWshw/l9nU/NF/PdeGSQNP+1mvve69kKVJ2wrGaIT3yMLKQ+PYzBQXLrzskR3aDhw45FhpNVNj/QhAoWaOwhtF8NAu7XPLrQO8CKkZTe8yHDHqmyuGu+zSgbR0JReHXTekHMBIty1aew39gSi0ujhgPOTHxtgc6uhnxGatdHJQKMTJPBW1YocoY4VtxkAHL6iy8Cgo1GF9SdN6QlQeqpGQ5Cyq5B7WL1kGotc/iIpIhn4tzlNwza1ZMlLwS4vIMfoYDVEjN2MWZlvLl6JLkLj0zpLBRIrp61CzNoXeuDvRNXPiRkMW9n4kvwnZ/ICIrRIpUDqKZ1MdXZx3CZo2gwhI36NlX27sCYtIOB+A7Z7bDOcwVQLvfNZmcVJgxVLL6k8A44j9MW1Jle89V1cS69TPsb7ZyNJ0pdpgEEdt5IzcbmmdHhYmCF+JRzGLxy5iwA/ZH4Ctl9NTpf5Fr6TasnAT1rxQEL99vde+TbQLEVYkMKHQzRC2Jzs7xPgszHYE7n9lNzTlbMPuuuTLRN7Uuyh3GBnOqiKziO/UO+UYt9T16EZ98ZzPjMafLjE452qGOdSXu30VfK11gIGKwsh3GQS308HHaTXC3E2z5QTM2xn//Of3/B2qfBkMNd/CTwuiIZcNKGk5AX4LhfKPJKap0gMwvZITKI6UGDcRzQcbP4B6QQT6I+8ZrvqKTE7s6I X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 20:wCdQan6CLlcnP89+IZKPxLgOxz0dhxLGO/TRhZ45MRpinPASBpNX3ApVFqx/GTwnV7zvFIhyriOzFiG0naTN54mexG+f0NujvkPfPYxSdd4goe38n/O7842wmDaBk1I3wbE5YWYC1CT5QHNl2TcDZXQCahBPH9uYhw5XxIdBA00n2ulTdLoZai+pG2SfLZFcauKG0BOHYL3cRcL1upGVcbvNtkSfTpv2tFLFdgf1xQLsDShpYjAS86GiVfhQGhxBF08hZTwdzldfF3pHXIjq9jcdRsI15+gKEeIs/QAz1Kes2KTis51krv+YMOZAttFA8MeHVCz1yGf0nC2aWLBD/Ek2uqPo+GelH61SFOB15QmnOD9ggCYt6/SgVme3LRVi7CEMKokAoegiOAPo9qXC+Zo5X4oFsw604P8DowFGfu/P/QBwtd459UON/5w3JFDoxiScUgKZEmrYUd4ayUPJtzEee84XOPcWvui5KwFhgUg+dghv/zrpCG9aNqhIBxj8aCdvQsZkeOJZaQgs7gIeoyj908PhoXjF1/+7C0td4xxIGJbM0dLtYdtndnXxeYCJFJ4UgPGzYkVUxtIi+EIl+eK9GTYYAY4R/tI2KDkse1k= 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:BN3PR0701MB1718; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1718; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 4:UF/gBZrSP7HtzVI/C0r5ReI7JiD6E93EA7thTG0ymy8ys2c4C085hL/3FettJ3Q1+5zshbPMBTx9NsDCyURo0foGTR/HM7rzNjDl4JYnzLUfBPV4qRDN39QtYqeaFWjEkgay0xexNY9xUrj6YsCm+yrOiRZ12aScCy+FVXTphTshywKohBAsLDXTLsJk59rnRCkhVu8V5qoZeC7PqHl6GnXjDEkxFBk6rGPvSZzrcXMCc0r0DtmSAuQuZbkQr4Dr4gBF5crvbdGSeAD4eRjeSJNonxxlQZzelyu/tiZapPyX1sZMBmpzr2CQh1mf2x/vgpBJktvs4wMt/GmHappmDxUu3BuLnLvpysgyKfUqwQgeppfeMWr0OjpniekPXnfa5VMdAETrh4PSfmpnIOW78zdbrOEnxmgwqM1lP4VmOKY= X-Forefront-PRVS: 09760A0505 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(199003)(189002)(48376002)(19580395003)(68736007)(2351001)(47776003)(229853001)(97736004)(19580405001)(586003)(50986999)(110136002)(36756003)(3846002)(66066001)(92566002)(105586002)(189998001)(76176999)(33646002)(42186005)(81156014)(5004730100002)(101416001)(50466002)(2950100001)(5003940100001)(4326007)(5008740100001)(50226002)(2906002)(6116002)(77096005)(81166006)(8676002)(106356001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1718; H:localhost.localdomain.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BN3PR0701MB1718; 23:ltgtv2Dx/Z78tKLUzZj/4eecaV5ukJMvjCpbjJF?= =?us-ascii?Q?GtUN1Jhxnm450I6PT+ndEjvJdkA/EcD1Eer0MDy6XBxWxhrCZVb1D7pbndWz?= =?us-ascii?Q?LEaTaFQfetGp9IZTlyqPFG9p6DQgvWF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kQ35lS4NjnoHv0X5AhdSblZf2hnOi4Nw44yojNmkHcvKZ7n3lUdzNk6CI?= =?us-ascii?Q?K0j4Tbk93L1qURl/N3elpDJD3SGT8?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 6:bP3DEFPu/3ukXf3PelrcXgU2IUTQEW3nc0brTGj2/tyKkdA0CubGZhhOhGVjNcZXFHabReVuwTDQmtbPbzwPHi1UdNOpLZT1X/O3U+BHX7vTNxxYntQvowhRVskrYUxREaVGR09+H18r6TtuGoNoHuRxvtKKr65/5586AlofIjFk9FrUcBfOjhGUaapSG1H1qpo78NF/dWKWcLHW85F/v9AD69Nvfx8mM/W5O/2WdGW4qoNTbnj3eX0PTUTKzb2+IuX2t8ED2tej7jl7c9ZYIoJiZwogAvb4hCwbwCsBu0o=; 5:Wepx7K7V/w+y4z2cse7/JIeSQFWAVpYjB0BcSNDjF9knfSSAXndYJsZcURBj+39teJbJxrPPQYOfh9/FLs8gmj31/75eTQx4amUkkaJWLGibFP3q4x9x4PwtagLCZxJhTxIGmZAIiRrU2QWiTgIdxw==; 24:E4xKnBq1E5TcdKdw6pJzmtjNyUx83/4mH/Wk9LlS1d7vpJpPY54DAhY2YzVbP+5BG5kgZLirqyYlWrJQZFqYzRQsHgbGctH5VWbMa/AJ8Pc=; 7:nju8OW6ECW1k8sDWpgpaL06uHrpPjHED4ZeH7LxlkhH/otLc4CQdFMFRWkq2z+0e/7IjahjVBO9Pudb1JcAGZVSBxX6qTqIuC7qHGbIP9/JJ2bLVhwVlbV6GMILmKPEOM7aOI7hLJIk9ImllKCKWLulniDttWBXGSlqF4FqmBh9I14p/KTNkuNkvzERCVe+DWabGYTjFtQ6egTx7ia0cUg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2016 13:31:58.9153 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1718 Subject: [dpdk-dev] [PATCH v6 16/27] net/thunderx: add MTU set 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: Fri, 17 Jun 2016 13:32:04 -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 | 44 +++++++++++++++++++++++++++++++++++++ drivers/net/thunderx/nicvf_ethdev.h | 2 ++ 2 files changed, 46 insertions(+) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 08f65b3..65b14c8 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(); @@ -769,6 +812,7 @@ static const struct eth_dev_ops nicvf_eth_dev_ops = { .dev_configure = nicvf_dev_configure, .link_update = nicvf_dev_link_update, .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