From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0082.outbound.protection.outlook.com [104.47.40.82]) by dpdk.org (Postfix) with ESMTP id 195D81B2D6 for ; Tue, 26 Dec 2017 11:37:56 +0100 (CET) Received: from MWHPR03CA0041.namprd03.prod.outlook.com (10.174.173.158) by CY1PR03MB2361.namprd03.prod.outlook.com (10.166.207.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Tue, 26 Dec 2017 10:37:55 +0000 Received: from BY2FFO11FD030.protection.gbl (2a01:111:f400:7c0c::176) by MWHPR03CA0041.outlook.office365.com (2603:10b6:301:3b::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Tue, 26 Dec 2017 10:37:55 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD030.mail.protection.outlook.com (10.1.14.211) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Tue, 26 Dec 2017 10:37:36 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vBQAbmE1009888; Tue, 26 Dec 2017 03:37:52 -0700 From: Hemant Agrawal To: CC: Date: Tue, 26 Dec 2017 16:06:48 +0530 Message-ID: <1514284608-9263-3-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514284608-9263-1-git-send-email-hemant.agrawal@nxp.com> References: <1512042367-6361-1-git-send-email-hemant.agrawal@nxp.com> <1514284608-9263-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131587582564932805; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(346002)(39380400002)(396003)(376002)(39860400002)(2980300002)(1109001)(1110001)(3190300001)(339900001)(189003)(199004)(498600001)(5660300001)(305945005)(356003)(6916009)(2950100002)(2906002)(68736007)(85426001)(8936002)(8676002)(81156014)(86362001)(53936002)(50226002)(6666003)(47776003)(76176011)(51416003)(81166006)(104016004)(105606002)(316002)(106466001)(16586007)(77096006)(48376002)(50466002)(2351001)(4326008)(97736004)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2361; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD030; 1:cjBgMaMVABqAJ4HatY0upU2tdaRa5weojUX3914s8hmDQEHmZS8YIcCNJB+9LJxIbsw6okDKha37PlU361L4BanNjQ6ohs5ydAoPXd4DiM70z+CEXZkNC0iDHRMJrobC MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d0b178f3-b534-42fa-9cc5-08d54c4cae19 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:CY1PR03MB2361; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2361; 3:wuBn9twUO7AMzYXeotzOpKj1BQrQmQXldycPPuFK/pbR4vTXT7pEs3SnU+tNk5EZdeFbZGGX7ZUPlSbHg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xHHdJmSEKb2bx60PKRdWDHDNOKwRFmrEae7Z2Zq6f1s0TPnV821E+vN0YF9HtGJkMiJe8ec1IHOmGIY3LeSbNd82qrc68yUOOsg8QEHca9cSdmOSJbeFWbcfMbFve2rU/DV99gE+9xHF+6CT8wYqFfWkJAD48Ozj01GMei+PEzgp4tpjjRR3ClWTQRImmc5rHrygOOb3EioR2r X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231023)(944510075)(944921075)(946801075)(946901075)(10201501046)(3002001)(6055026)(6096035)(20161123563025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123559100)(20161123561025)(20161123556025)(20161123565025)(201708071742011); SRVR:CY1PR03MB2361; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CY1PR03MB2361; X-Forefront-PRVS: 053315510E X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB2361; 23:8/8Ka37PYCBpB4cGbNRbYm3D+CR4JsLQBrhj5ZCCb?= =?us-ascii?Q?bOo/AsSTJTNA/+xRynvgXlzBfQI+Jt4fdOEupnwYKgH0R3T+kDHiF0O2VUCa?= =?us-ascii?Q?xkHUhG3jBTzM94VvAWhYC1zexWCzP/O+xQSdDa56WqaBqongk8RVI61YjrnO?= =?us-ascii?Q?9CFAQyJn6MdHyQU0pKDC1a9GrPUSYA6KHUAqqvc3nP62t+Pbav/KYXL5rjC6?= =?us-ascii?Q?/tIs78UBFv72ENQNZavbIzQathW9G6tNPhTC46GG58acZukOQYHkI65i5S/u?= =?us-ascii?Q?ld+NNY7zstb11sLisviTsrohUEoPQuzXn5Vm6lLk1XpUgNABSZGiWy+nO2wm?= =?us-ascii?Q?wmFXeSRyUV9w9/JQbzLSeHFkzm4CpgkJSzA2n3+qylLWjS2ar935li5bkE6K?= =?us-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aqVbvpYiU2/NOo5gw1VbMqWwYLXIa29DE7D4Btqa+9CrXv2iRlRQfIvG+2vyOIoa83MZ5bZUozB6quUIK/mcYhGRjKfhSwy9b0xIj/Nv38pUFd/TUXY3MfHKymrg5Uzsc4eGulHh9SovLSnoXjZyYQ3nt3L3zEtIPXFM6pN7Z6JEUZ0eHwWmxeSO4=; 5:cDvYjEmQztnSE8Tx7wLcKu5QKgmLurg7w32wbFT8H+zrqV6yH/1PBytDkDvzhd6t4dxOg8EG5yt/3tVz0/Hrc6lTpgLJJu8JbEdM4oGIa0cVHHXa5/aD9pDlrFO1bDFzYJYQa5drhQiFhcaDj3TC63FZ1KTVZAl713KpTcq7e7g=; 24:fms+TPdEZOCZTCTLm5xB4DcIVO0mKOfAk/N6p6/FNC5gY2fQMhqf8OauKX68qVjiUI6iJiaZFtdD3O7JA4vkBB9If18Dzp6xcZwmRgaQCgc=; 7:fw96HJhTOBSpEqWEi5IkSNuSHQ56QAEkQtYecfHDAEimq+0ekR+HTSqbVmj+3oPCrq6c+PNT3RBolBz73kaP8hWvWdeOXw3WPK0bTnUGx2xCUC3FyKaM8L7WtZX9+fP7s0OmMcwOFYkdtVhfkQH5xhvfz9JIyF9wF4XUJE72Vx31XQgGz/L37XAswYy6NXPPu8E2dtkWi11vlqFpR+Eem7Qc215k/4JOrZXbMjKU5QYUeKooXhAUeKoqdgg08xET SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2017 10:37:36.3060 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d0b178f3-b534-42fa-9cc5-08d54c4cae19 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB2361 Subject: [dpdk-dev] [PATCH v2 3/3] kni: set initial value for MTU X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 10:37:57 -0000 Configure initial application provided mtu on the KNI interface. Signed-off-by: Hemant Agrawal --- v2: fix ABI breakage examples/kni/main.c | 2 ++ lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h | 1 + lib/librte_eal/linuxapp/kni/kni_misc.c | 3 +++ lib/librte_kni/rte_kni.c | 1 + lib/librte_kni/rte_kni.h | 1 + 5 files changed, 8 insertions(+) diff --git a/examples/kni/main.c b/examples/kni/main.c index 1c251c2..d9c9fa5 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -845,6 +845,8 @@ kni_alloc(uint16_t port_id) rte_eth_macaddr_get(port_id, (struct ether_addr *)&conf.mac_addr); + rte_eth_dev_get_mtu(port_id, &conf.mtu); + memset(&ops, 0, sizeof(ops)); ops.port_id = port_id; ops.change_mtu = kni_change_mtu; diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h index b519db5..2e393c0 100644 --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h +++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h @@ -172,6 +172,7 @@ struct rte_kni_device_info { /* mbuf size */ unsigned mbuf_size; + unsigned int mtu; char mac_addr[6]; }; diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index b524d30..0ccd227 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -470,6 +470,9 @@ kni_ioctl_create(struct net *net, uint32_t ioctl_num, random_ether_addr(net_dev->dev_addr); } + if (dev_info.mtu) + net_dev->mtu = dev_info.mtu; + ret = register_netdev(net_dev); if (ret) { pr_err("error %i registering device \"%s\"\n", diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index bed3f20..2461b47 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -369,6 +369,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool, dev_info.force_bind = conf->force_bind; dev_info.group_id = conf->group_id; dev_info.mbuf_size = conf->mbuf_size; + dev_info.mtu = conf->mtu; memcpy(dev_info.mac_addr, conf->mac_addr, ETHER_ADDR_LEN); diff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h index 4530bdd..cbf3188 100644 --- a/lib/librte_kni/rte_kni.h +++ b/lib/librte_kni/rte_kni.h @@ -98,6 +98,7 @@ struct rte_kni_conf { __extension__ uint8_t force_bind : 1; /* Flag to bind kernel thread */ char mac_addr[ETHER_ADDR_LEN]; /* MAC address assigned to KNI */ + uint16_t mtu; }; /** -- 2.7.4