From patchwork Thu Nov 30 11:46:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 120141 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp558280qgn; Thu, 30 Nov 2017 03:47:27 -0800 (PST) X-Google-Smtp-Source: AGs4zMbug07l3yP2lrkXSb+8ulat1lh1I9JeXZlFmz6fVSGMLR23c88Dksiy1o4ADXUBY7aXxkRc X-Received: by 10.223.135.121 with SMTP id 54mr1757927wrz.160.1512042447054; Thu, 30 Nov 2017 03:47:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512042447; cv=none; d=google.com; s=arc-20160816; b=De4Z+D4PuEdy7g69AJu6jeIV4+f5Bq+U4DRuXodkgXY939ASohkHLornz75p7tRt1p aKuc596QOZwRlRPdAHsVOYABwaqxixJrhPaImrUWN4PIJmzxoTRuVkRwa0kUKIKt1m6r ruiPbpvNC2Q+XMSd83SxbgWSUvWUUnMniEbecLOZIcWONcEU36pj0lO66uDw1x2ADFUn CGr6XgePPeffySGgcdsXCMLvvuW2czV8mOtdMR3TLsd4sImQa3fv7iUF/do5NmcbWtRy aeCKkitqwv/NmIYVqZcQUv6w492rTDkb/k+ZTJJkeUlfG6wDNl0M95R6k947PRhCCiHo QUQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=kmNRwIbjO1nd2iLZgWSxUoEwQ1SKBAI+pHdtgym6R9o=; b=W5d+6yul90ZnQ/C+xgZjQrF685rRQ684RpCv8GZp7aywbyYZo2wTzTCWZrJoeafCw3 fmF/VrsJg4NttoC3I4OqnFWD1UI5xoZWuxfZT3N6fgzaWaNrx0eZ3sXp4YCiG1/lFXzv pZnubAFqn0+64SekZ3aS9sNMCiU/3hW3Q6rdi5rIsEnEPlWbbAfbeMhaoGN5RbyQVb5q ucxEEKdRr76eGVpDxTmEPjTlxKPLqpHou00W6ikeo7TIz9eLNp2GH4yEA1GXsU5emP/T 0lDBoiz594psn85c2J4CLhnr+NVsuam7okcAZmiywrnRNWfWAqzGQFSG6oVyvHuhhGEn w93w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id v3si3270199wre.426.2017.11.30.03.47.26; Thu, 30 Nov 2017 03:47:27 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E38B63258; Thu, 30 Nov 2017 12:47:09 +0100 (CET) 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 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+oAoTVYzXNp9mXLyk0KuAHts4KnZhxZpj5AHiKhkMzkwxeuqb4AIixHH54TpFfE03RpaoUpYhTcQ89d4A7BD/0wYGUxJEtT3cxvR93ZVc6eW3dm6Zrklf8C9/bjohJG00kGH5cvEO945CnSsx/BIDUHku29vEeGNGNR3dmj4UBxxr5KBbWC0jZro+31U3SZGFVGvn5O8DRSZQLAzsjNr+ODOUa3v6XHE6apo0zcYGnG0ZNjpQA8vhdNyQazeu/mx2YhGcL6iJowDA7MFdSNNSx57pik2vTtK8e5OzwTIsLmp3PfAKZQawt9I=; 25:AZyARWc4ZhohTB4i4YMeht7KfMs6bMXLOPCiVhjuuXS4Z+ZyswEXozqFuXemP6sKI0fbGG5M+kB8CDLRW568TZMq1kN8drcbgS2uFEd5xhI1OBXyMriKWJrq6Fg8tb2OgBYvR07gGg4bvkUf/FAvcZIl+69TeVYj8oSwOHc8FwWb34u39uzKxI1lXZtCM1z1X36tCJHtwwHxCku/w4xhJheMdvNBG22dEeunXXtygjnNnXSuUf6hgwPQmVxR9WlXoqut452Bfo3dXsj1Vhq/dOnB7WzCZ6gNr4TiFgIjZr8/Rgi0OifHgaHUcRhKZiVuY1Hi4Muo1n+sFfS31i+7jw== X-MS-TrafficTypeDiagnostic: BN6PR03MB2690: X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2690; 31:4PSrPr8phsaLc555I5WViZmwnVDS4veDi8RdBBkQYGzkAnSLNXopgi4ERGWH4sMzDBUNRf4XC9ae2XNyEhYg4DBLhfs0rh4OwYuI0kNp26pupVyk9ePVwVHjqh/TQ6XWbcT6J3ZD4cIGYZtZFcgBmbdHq5EdKIBw/nBpKrj5PFlQK0B69kAy8P7nZtqtclIzdSB0VlVitgSXW+vjbPalXMgoXhxATDHZd19wFpJvlF0=; 4:q5aAc4vprOFEjpOQFbXkk+w8YuaIbb2iqk77yhXWdo2jgv/ihZfp6hqbIiGmXiOop1UyFlOcNwBv30Ym0cReBX7Ed9WSuBNh/il4o1wL2Aulwkt8BWgWkuuEnDunzLLW2hGcvPL2SDqVNafOFCkLn79nK3zNalGuezvurSje/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?= LC2ONCXV6cig5ra0YUz4T7WKYBLzXcmovRpnIb7QgZpFTbpb3TKyatQrTTIDo7r4RaVdCbwlGTEbmtbCTv45bQxa10Z+GUJC6qwBUy6BOPoRD+KNw9qcoos9GaVyEvNGrMXvZb83sCAfBm1Vf2tiSz4R5jGpi2NZscCeVyEaqvJtdPPjBmxhsiXE34R+omuEcofdftuK1PsmIQ7uff+k9XWBxTN1u3jgQr8w5nmPFmhoydxm9v5PwwFoU0h3/a7t5f1bL54X/r/Q6/tfJbuSLDAK10DEijo4oo2TW8v6cfsmTcmf8q+SEw/b0+TODpcTj93yPXHiBvZlEmqkz5O/UNfMX4slz5JCEdbyVok7HQ8DcRhEIK+jdmxPqUOs920KHtJt2aX7l37KM+iCunRDSNKm9sQJhbwZufzx1TPw5tDhej3CU4f+4iyiXHXWNUC/QaJQBF0BGfiEX0MpxLbSBAOYeEy440U6Fyx30qRxMKRLLgsN0gg309taaHLbB6ZAyg6m9pUEJlbNr//3ARqocLvg6ji7g+TlvXqfxOwi50uOqlHZ15AEJ52IApDYP/O5R0SC39DEfkIvubUQEmxwqEBOxG2YeFTsKhpXpntCb8s5KK8bO9PfQc3O6DLKi58gkNHvBRA+kNfp40XIsCapofg81ZROWF+QDcBzfZniua4lpU1s/aUXXsJ329SIaWYPff1lO8T2MGRmeshO+8yoCaNaXkcSr6Ne6e5GvU1J+Mzzyt92XZ7i3jbKu2O7AW/VlmE+bWimiv1r7xU9oPEN3mBki6IVhkGyNIoeTIVsu/JPlH8ijR9DqhgxXmV2OdotwtXrb/NnhY7S9LJj9B4BVSey9VrRKE7/Jl2WSeeTH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ski8h+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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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(+) -- 2.7.4 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 */