From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0072.outbound.protection.outlook.com [157.56.111.72]) by dpdk.org (Postfix) with ESMTP id 4F9134AAD for ; Tue, 7 Jun 2016 18:42:01 +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=q9YOGbF3NvF9DkSstHyPDV8J7eakT6diG1Iu5sZQW9Q=; b=njzRR9NzLQoGDa8Md0v9X62JEoJPch6Zu2bh+44fy1BvRk51dPo6g9n/AhZ2qZ+8m+k4/Q5ChsaEzu/0J3h9/1JBA/CfxNcx7n1ulf4Sd9f/84vEt4yBYnxjof9YiCEV0MwWMrbPW7d/KF4MnvIfhTfcIx3RFPYX1G8QtPnHnZQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) with Microsoft SMTP Server (TLS) id 15.1.511.8; Tue, 7 Jun 2016 16:41:57 +0000 From: Jerin Jacob To: CC: , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Tue, 7 Jun 2016 22:10:22 +0530 Message-ID: <1465317632-11471-11-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465317632-11471-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1464540424-12631-1-git-send-email-jerin.jacob@caviumnetworks.com> <1465317632-11471-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: MAXPR01CA0054.INDPRD01.PROD.OUTLOOK.COM (10.164.146.154) To BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) X-MS-Office365-Filtering-Correlation-Id: 5083d98e-35ee-4f4c-41ad-08d38ef2a578 X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 2:aLQX6J2llfWOu20xM6rEAF+A6JZbX1f6zitaDOthuTun1ZoAFYan3gyigsADzAQWOVQHuWGBYk4jP/+D9PfqKjKpxr/MD2LeDvRL6Q2T3fadWQZvyUEjUubYNuE7Xx7kIPFpdnMzHrMrOkUunzDcYxf3UZXhURA8ERsS88rFiv+OhIYJwPAP++MFBxY+/6K1; 3:TuYrqiEbK77nIkGR22FYVglzDudx+1vfBtbvkg65nJOXvd0zJVNYrzLPhsKn2Vs4CCmteIPSd3RUMeCa5WeN/Bzw4J80J+848zJsjf0GO9eiETKO8ZRWhfro4leykI1n; 25:Xk/Cl8x5Em9jLv220H9jtYVFkY952nTrLw7r0mLgjya4Oe5fLkGHtdblnynivAzkMXqmNzpm97E/lXDq27nthuiLikJipQnpEQisq9qmn3PF81XBEK6zIAzLPdYEKqRK3TxlaQ4rT98bNkX2hk0Ek26GbpEc3hhtgKsNdOdOdj470OKkGT8yHKcZr/SNY4TeK3MECIyUBt7hjxccWrdsIXEZLKR/V1CKfImYBgOsMFaUcr+BpFIqA5qNaNaxGzJP0Zfv3+6bLnnb/b8pFE+rDzKny2X6m1bInKRC96Voxwx/w+qd3fpTKrvv/EF64pdTfcNcmuSXkYTcItau+tsg/javIo1I60hBqQuKE8PT16KFyCh2tW5PD3WSk7dD0xvFiVvpd2lXe/h7Z72qmuAKhTawKlWAJWvBBUrhV4LJc5Y= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 20:28ORG9cPoEdNqGYGIl0g1XANfx+CCYWIwIOwraQRgDI39IPweTaorwUrL1bvklKriimfssmOiOLlcJcJcYSXd1sG60d7qA2pjL95Ovd/J//VNcShidZrD/42KtcnjGp1HLvTlY71Y7TtDCI7O3Cd4I1bbkzCNJhJez7ECXVLMZ6AIflbR3NYKinnmipIhuoet9PrLga7i65AfRSQPcRRI4rU0QPX1QUR8PKiU2xNHJsozEMDMHYHX03wBN5p0s7sUwpOmmKGyVxuJktLCvLfCQO0pIZl3x5vHMCXX1cpdnBJQ86pU+veYdduASpWZaBCN9XuItZYghWJH1umjXCsoPpwY5GOLUQSQpCc8kyYYXcvn0om7zJf8AXcOWGZHdqpESUDm/LkrlU8MTxT/nfwTHzA+qaa+6pU41VeCViXm1W+rzPeRhsX+Vpwk7eZcHh7vHGTEHK4wM4/ckCSD1tu9kqN3EMWVgRnCUX0I3GW/QHPWr0epk2zYFRgGqySfMsj4jOeZAIdonf23f4nRTB7z2ehB8P4C+GgFt50qFm49uXGzCuJLhzKnX9qo3THXKEKDh8wY0yW5zdTM5/TMG/ihEWDSmyrkn1hwkXgzQDymFQ= 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:BN3PR0701MB1719; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 4:WYRElsCaRWNQQKL1X76MB5cRESzCnVzZmxcV0N3UkaQrZIRwhpVvIrKJk94pu1bA6yaosl1kEvm5fnH1ZdAFjs3xIqM7dPRSNBUHjQpudlpkNo9Ra8KD7DMUV/gsNpqTSXsPZSh/TN7f4hKzgaC/Wv6X/77G8bA58AmLCscA4url92011LZZX2xWRRmmMkZfnziDZeq3gnL0wlMDzipQW+Kcs6Mb7xOssbM2BJd06LsS1M8h9CB6lZ49WjXUCIJ+ehI+YscgNraAQZs8jzzlcnEdADXzsiOtx2DGHkcEt7xV1Nmb8XAjY+Dw8eDy5OmhWI43KhIEw5AVJ0AYyNRG1HFt4rEodiW620K5bsrMxHrUBpbQn4IuA0YxBPRVxFkb X-Forefront-PRVS: 09669DB681 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(199003)(189002)(81166006)(8676002)(81156014)(47776003)(66066001)(36756003)(92566002)(2950100001)(586003)(2351001)(48376002)(76506005)(42186005)(50466002)(4326007)(77096005)(3846002)(6116002)(5003940100001)(53416004)(5004730100002)(575784001)(105586002)(97736004)(2906002)(5008740100001)(106356001)(189998001)(19580395003)(69596002)(101416001)(110136002)(19580405001)(68736007)(33646002)(76176999)(50986999)(229853001)(50226002)(5009440100003)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1719; H:localhost.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BN3PR0701MB1719; 23:APdnAHRbpjJ0/xwVuWjhi99aSFB7q6esDHh/Duq?= =?us-ascii?Q?TPt5URRjWw5xKjXm/s+n46sKcK7vzoqKwH1LU1Y3+WMDyzPq1z93GpbUQw60?= =?us-ascii?Q?CT7OsJmPdzFHfFBxdMmEIeaR0iG4B9TP978t7f9Sm/OSiNLylFxH3Zf5i6MY?= =?us-ascii?Q?J3E0YSaeNm/ri3lulDoGm/Yos8z9q8IfcIIk7O75gm6G6j1Lhb0rEGzzX8qf?= =?us-ascii?Q?z3uqXs7KfZFzQsOgnwZidxZIJjb16XHvUJz2dsnuNUtZX9MpyS95fUL1wBlv?= =?us-ascii?Q?RybH2FYCTIdJ0cFHN28Gg6RbOok8jk0W64HDLrzpSus6AU9xEJxhpj4z7Jrx?= =?us-ascii?Q?wYbJK+7+MN0hkj2f3hEce218o2nk8Y7YWortvvuWBDDMPTNyQ0o/aUWN1pM6?= =?us-ascii?Q?pqombLtIMLdrbkN6/RtlSCRvt/FyUtNaNDzZ3clk7JlGAdlGQtT2qF88Qat6?= =?us-ascii?Q?/snCR+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T6rxyD8/1onbJpVRQWnpw==; 24:FMRDiBl6BfJctmchl4/Or0+OT6aDDr7UNpoc/HstPE1wS7/FCoLO216bXL5WU9cY4nAdFiOyvoaBr7gzRl/yES0v9UCvtg1HgU+0YNYYf7Y=; 7:7jRX1NmoWLriF2+AG29yGwg5eIqilcB5MFnl8iV4H5OLN3BLI5oWBmagw/7IRGoHsu/HA53aDUCigjg5IRG08TNSBJNxRkC6SIA1Stjp9PtzetU3MMJuZ2auXkKUOy5IAipNLR3HUfHKxgZvCoonKs1h1G37HH2skR2QKvoHMpUM9ra6jABgFs+MWcZCpONTir+C+5fmwqEI6Y8IXItN7mEJhsPKxDIeYGdfkR8WGqU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2016 16:41:57.0112 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1719 Subject: [dpdk-dev] [PATCH v3 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: Tue, 07 Jun 2016 16:42:01 -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 efe0e05..7a931ec 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); @@ -171,6 +173,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(); @@ -195,6 +240,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) { @@ -795,7 +846,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