From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0059.outbound.protection.outlook.com [104.47.32.59]) by dpdk.org (Postfix) with ESMTP id E0CD6324A for ; Thu, 30 Nov 2017 12:47:06 +0100 (CET) Received: from CY4PR03CA0083.namprd03.prod.outlook.com (10.171.242.152) by BN6PR03MB2690.namprd03.prod.outlook.com (10.173.144.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Thu, 30 Nov 2017 11:47:05 +0000 Received: from BN1BFFO11FD007.protection.gbl (2a01:111:f400:7c10::1:167) by CY4PR03CA0083.outlook.office365.com (2603:10b6:910:4d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.282.5 via Frontend Transport; Thu, 30 Nov 2017 11:47:04 +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 BN1BFFO11FD007.mail.protection.outlook.com (10.58.144.70) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.239.4 via Frontend Transport; Thu, 30 Nov 2017 11:47:04 +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 vAUBkx70031415; Thu, 30 Nov 2017 04:47:03 -0700 From: Hemant Agrawal To: CC: Date: Thu, 30 Nov 2017 17:16:07 +0530 Message-ID: <1512042367-6361-3-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512042367-6361-1-git-send-email-hemant.agrawal@nxp.com> References: <1512042367-6361-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131565160247832456; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(346002)(376002)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(3190300001)(189002)(199003)(4326008)(77096006)(33646002)(50226002)(316002)(189998001)(16586007)(85426001)(47776003)(305945005)(36756003)(5660300001)(68736007)(104016004)(97736004)(48376002)(2351001)(50466002)(356003)(106466001)(50986010)(76176010)(51416003)(81156014)(81166006)(8676002)(498600001)(8936002)(53936002)(86362001)(105606002)(2906002)(2950100002)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2690; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD007; 1:XP71NgWOsEuAbTR2/lx5dvYEQ17pwT/DNJxxN/mjN3IoL/s+Vj3TJEbxacVBbb1K9ApaLeXAIkiCKSIsXPcUyc91foa78IvwZFZLo69iWh0l3qMjtw/JyhzHgDnNE0Lj MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9adf6e4e-3930-4d2d-4e28-08d537e813d8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603285); SRVR:BN6PR03MB2690; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2690; 3:XmUB6yDWtbb6uH0KJ72zppFtV8TM7DTWK2eNKnSzLywOUBvH/I5+oAoTVYzXNp9mXLyk0KuAHts4KnZhxZpj5AHiKh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kLn79nK3zNalGuezvurSje/vgMbvkDPYAngad+qSP/I1rA5OAAYmjEj/2kb2urEMw3gZ2yPHD6I/DdW8qzQ78bPjBf3Zzh6/L0JVzfTtOEMDG4zwwwh4NoJ9nGuYnZGXjlyx2wBqKBKTdn9TT43DT7A/3l+0QWLXRvwSY48KFtroaX 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)(3231022)(10201501046)(3002001)(93006095)(93001095)(6055026)(6096035)(20161123561025)(20161123563025)(20161123559100)(20161123565025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123556025)(201708071742011); SRVR:BN6PR03MB2690; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN6PR03MB2690; X-Forefront-PRVS: 05079D8470 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2690; 23:9H0k0dXh0+CupfIr2mbY5X2gJrvX/LWbyU7+UvWdV?= =?us-ascii?Q?LC2ONCXV6cig5ra0YUz4T7WKYBLzXcmovRpnIb7QgZpFTbpb3TKyatQrTTID?= =?us-ascii?Q?o7r4RaVdCbwlGTEbmtbCTv45bQxa10Z+GUJC6qwBUy6BOPoRD+KNw9qcoos9?= =?us-ascii?Q?GaVyEvNGrMXvZb83sCAfBm1Vf2tiSz4R5jGpi2NZscCeVyEaqvJtdPPjBmxh?= =?us-ascii?Q?siXE34R+omuEcofdftuK1PsmIQ7uff+k9XWBxTN1u3jgQr8w5nmPFmhoydxm?= =?us-ascii?Q?9v5PwwFoU0h3/a7t5f1bL54X/r/Q6/tfJbuSLDAK10DEijo4oo2TW8v6cfsm?= =?us-ascii?Q?Tcmf8q+SEw/b0+TODpcTj93yPXHiBvZlEmqkz5O/UNfMX4slz5JCEdbyVok7?= =?us-ascii?Q?HQ8DcRhEIK+jdmxPqUOs920KHtJt2aX7l37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uGZs4Tahgc0/9p0aN7Q9F5Ys9gPK3TCfkaxOdTqxZY20McgAJ0zpOYLYrHdeduvtFJrFCPJCQ3Tg6KHlpbznv+yvU8lfL7nLWgsHyxOBX9I+h8uiPBwkZEzFp3qk8I/K2Ei6AaD9CZsUghdxqE7ibz1SAGfAkayxZa/v6ck6BDLlHN2k1RhIU/2weAMko=; 5:H3nIAyxRcYw40ybfVFqiOhkvJkDieAY1JTaoS1ZmeRNeRUJSKqt8FgalNnzxvc0cClQSLfvug4BCB3tsvFqSpJxOnVVbAwt4FLpsXJUMn3hZewydfcDvbL9+RGtJl5QXE/hBzeiIPyQDsW6adhaGiZJfc2hydGUpFyyEZg4zAbA=; 24:ZClbXTgIhYuB8BEkTf9vRAiXw/rKGIkXXd1N4zDY3c1+D2Ft1qc/VjMXNtjxIXpVLNofYIikDxa26jGXHg0XcezBdysW7U3mXGTHDAyMqJ8=; 7:nEaonCAETqgXdDk5nefHXiM409+3I90P2ePkV7B7viQ/LSDMxa34NVZVlAJlI/sSXg9RaYMFVFgNvvhdxZA9SRvg+npFBy1lp4QwST7c21dqinIkzmfVDshaC4o3ZXIgm0SKOPWRbtOZ9oXM79PDYZbY3dx5ski8h+5tv15tGsK6TyXI3ULHAaCgOfJdKlNFV0BvYzSLkRrbLcs7P+Ev4foB7z20BQoe985d+aN0k829dGzMx1+ImDffnx6neHgG SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2017 11:47:04.5960 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9adf6e4e-3930-4d2d-4e28-08d537e813d8 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: BN6PR03MB2690 Subject: [dpdk-dev] [PATCH 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: Thu, 30 Nov 2017 11:47:07 -0000 Configure initial application provided mtu on the KNI interface. Signed-off-by: Hemant Agrawal --- 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 f2ef48e..9fdaed9 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 e8cd297..8b31747 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -367,6 +367,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 bc5ead7..37dded6 100644 --- a/lib/librte_kni/rte_kni.h +++ b/lib/librte_kni/rte_kni.h @@ -95,6 +95,7 @@ struct rte_kni_conf { struct rte_pci_addr addr; struct rte_pci_id id; char mac_addr[ETHER_ADDR_LEN]; /* MAC address assigned to KNI */ + uint16_t mtu; __extension__ uint8_t force_bind : 1; /* Flag to bind kernel thread */ -- 2.7.4