From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0040.outbound.protection.outlook.com [104.47.34.40]) by dpdk.org (Postfix) with ESMTP id 8963D1B1B8 for ; Thu, 18 Jan 2018 07:14:15 +0100 (CET) Received: from CY4PR03CA0105.namprd03.prod.outlook.com (10.171.242.174) by BN6PR03MB2691.namprd03.prod.outlook.com (10.173.144.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Thu, 18 Jan 2018 06:14:14 +0000 Received: from BL2FFO11FD005.protection.gbl (2a01:111:f400:7c09::115) by CY4PR03CA0105.outlook.office365.com (2603:10b6:910:4d::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.428.17 via Frontend Transport; Thu, 18 Jan 2018 06:14:13 +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 BL2FFO11FD005.mail.protection.outlook.com (10.173.161.1) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Thu, 18 Jan 2018 06:14:12 +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 w0I6E6hB024428; Wed, 17 Jan 2018 23:14:10 -0700 From: Hemant Agrawal To: CC: Date: Thu, 18 Jan 2018 11:43:00 +0530 Message-ID: <1516255980-25092-3-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516255980-25092-1-git-send-email-hemant.agrawal@nxp.com> References: <1514284608-9263-1-git-send-email-hemant.agrawal@nxp.com> <1516255980-25092-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131607296524784087; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(396003)(39860400002)(346002)(39380400002)(2980300002)(1109001)(1110001)(3190300001)(339900001)(189003)(199004)(48376002)(2351001)(50466002)(2906002)(6666003)(76176011)(97736004)(2950100002)(6916009)(51416003)(105606002)(498600001)(5660300001)(36756003)(47776003)(106466001)(86362001)(26005)(85426001)(316002)(8936002)(8676002)(16586007)(81166006)(81156014)(68736007)(53936002)(104016004)(4326008)(50226002)(356003)(305945005)(77096007); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2691; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD005; 1:rpibNDLXFNawJ+kn3kGq50SDiP5XuIxwmAzKVPuD6GZ0BEr0eU9I3qqKMEriEfHIGr7TZQA4t4etTyaCfqTiUJdoC3liKoKE4uqm/EctVpQTfeoRdGi+1ROAA1u76qun MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ed93190-e896-4842-91d7-08d55e3ab1ac X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:BN6PR03MB2691; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2691; 3:66Oj0u0xlJvtnnu0/6tw7fRebuSsnXOf4UNWH2KpiqRH8jbqbQ6/4oSBMhkggj/AoShd8uz9syRrqL+GL3rMAysBo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cZHW7sYbtueVkmsWy7vc671xicop9XGXkDvIUm47XYDNG4WY7yNi02lqVFfA/J8YTNIuwCvVxP0L+xx3pG9qp7TzoOs9Fmm5mx28pFFoVmcKKf2ciHsc8+l28Icv1Z66SbbybdEtpaA+pLrd8GElATHZFPW7TIv8mxFS0725r+izQGTL6t X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231023)(2400057)(944501161)(10201501046)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703151042153)(20161123559100)(20161123565025)(20161123556025)(20161123561025)(20161123563025)(201708071742011); SRVR:BN6PR03MB2691; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN6PR03MB2691; X-Forefront-PRVS: 05568D1FF7 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2691; 23:rM4QEnWpsnR2OeusEsI2nLQxNuOOcZZ8mkDT3uJxl?= =?us-ascii?Q?yFZW7QKRuJcv1BP/jzYTqyXCfhbgMnj5qKTHLukT/zGv9oSut00JR3PrEh5p?= =?us-ascii?Q?ejJLvdz6YnDvacPTwt1kOxegF+f3/aXVr3ac/gffSlk0ryW3jOoHPUSPKgz0?= =?us-ascii?Q?nuxnfAOBmTmuVT6uScOWReIn637KvoO8qDJk0rWWb6ebeKx9jSjUQ0nyJ70F?= =?us-ascii?Q?OoUwx7n1zpzeeTT5F7uTu7ZvzM3o5gfbyOnqoObfVZpwF2MePe92ePSa1VrW?= =?us-ascii?Q?rYQKwoEmGunZYjiyU0Lb0BbFJ7chd5kE0QQL/ErOxrB2T0kh91GYDEwwj8U3?= =?us-ascii?Q?SbikurQZcjS5tVdeBjj7W3mOXqpOLsUVNSaJhGe3QFUeC47uwJNB+rfIqQlU?= =?us-ascii?Q?2p6ib+AB7Rsq8Q5f8GYSOKvO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liFvPkM1HZV2gF7hP0rO4qZX6eCx/3tERSzicyAbweC0xP1IQD5z3NDMizynrootXI9eG1rqNruS7pMgkvbTrs9pSlOutnOnxzBFUSaiycdFh+KgFpI3aZ/3U1GQ=; 5:0+Jo3DMSWhfrdka+UFeeN/pGx+JEddlcEBj5dCIf8UnV4hsXDhX7nWWCGdptkE+F0Cdvpk5MKuBvL/xBd1oNB/ferSR53NKWU5OWB5phsBbMYJOgWslCXUn9fWYZklToTOUhd9dFVTL51TK7LJQnnZQh1V+0a0zQZ2EK7k5MA1c=; 24:KX5qFW1KNgj+LByJTCW5bhPCRKFNMSAdNZEb+ClVvGPX4Df4hziewFT8Ai63y1+/UU8LFyJzuOr4SpDQwu7lwOXaY+aZF02CRJwYnrRg/zw=; 7:fkdr/Bn28+dI2ooCqFBNlRkfxYlDel0Ypx3P4LIzrYJ+jqUBgqrgFyYypAMmcM+Ho7X54cwIoXWiTveNfk5EaJFxpTAqEm2lhVW5M52L5vllxOARYJEa42EFQbH7Dr2mP5YVwBe2pizjwuCFlBXoDEcZxbYbvHwz9OoS1loeC0dMc4l9hkfye0BfpSVlJ7RHUvDUvQ5hkZW1yFuT9S2MQZARekpWuKekU0Lson3A1Y+QWxWAF35LT/NKdwm4Dr1G SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 06:14:12.3068 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ed93190-e896-4842-91d7-08d55e3ab1ac 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: BN6PR03MB2691 Subject: [dpdk-dev] [PATCH v3 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, 18 Jan 2018 06:14:16 -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 ebec433..e5cc30e 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -846,6 +846,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 b186417..cfa9448 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 @@ -120,6 +120,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 83649ce..01574ec 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -451,6 +451,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 c089a49..2867411 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -340,6 +340,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 711c2a9..99055e2 100644 --- a/lib/librte_kni/rte_kni.h +++ b/lib/librte_kni/rte_kni.h @@ -69,6 +69,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