From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0066.outbound.protection.outlook.com [104.47.37.66]) by dpdk.org (Postfix) with ESMTP id 0BEF468A1 for ; Wed, 3 May 2017 13:21:32 +0200 (CEST) Received: from BN3PR0301CA0081.namprd03.prod.outlook.com (10.160.152.177) by BY1PR0301MB0904.namprd03.prod.outlook.com (10.160.195.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13; Wed, 3 May 2017 11:21:30 +0000 Received: from BY2FFO11OLC009.protection.gbl (2a01:111:f400:7c0c::142) by BN3PR0301CA0081.outlook.office365.com (2a01:111:e400:401e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1061.12 via Frontend Transport; Wed, 3 May 2017 11:21:30 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 BY2FFO11OLC009.mail.protection.outlook.com (10.1.15.0) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1047.9 via Frontend Transport; Wed, 3 May 2017 11:21:29 +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 v43BLPti008454; Wed, 3 May 2017 04:21:28 -0700 From: Hemant Agrawal To: CC: Date: Wed, 3 May 2017 16:51:09 +0530 Message-ID: <1493810472-668-2-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1493810472-668-1-git-send-email-hemant.agrawal@nxp.com> References: <1493810472-668-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131382840899341909; (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)(39840400002)(39450400003)(39860400002)(39400400002)(39410400002)(39380400002)(39850400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(9170700003)(5660300001)(50466002)(189998001)(498600001)(48376002)(50986999)(38730400002)(305945005)(77096006)(4326008)(86362001)(104016004)(53936002)(36756003)(6916009)(2950100002)(76176999)(2351001)(6666003)(85426001)(8936002)(110136004)(2906002)(106466001)(105606002)(8676002)(50226002)(81166006)(33646002)(47776003)(5003940100001)(356003)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0301MB0904; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC009; 1:XVV22PQPnNyyic+VY9W2VKhxgJoPsx1EAe/SX223Lc0DHMB0xR61QqZcGb6JLiYBEs+DP4XM8henh7U/hh1Ddy6VzesHnZocBUJwt0FYN4BvH0KkH/5ZTWwjffkllCfdKiPuVB+qeu10LAxkCVBVbVqnl66pt1gMyOUC6TkGMy/LkMEmO9H3ZJxKtPeaYQnw+8UMDR6TpkQva2kaJAel3QGWRRNoGvq4JivK6qGInHtlhCZJhwWYutYF+HyoPi1k5OBF8B5eFA8qnZBOxIqnzz0KrRW/aq10ekC5bMdbJEVwXFYCye9JWeypA63GDXlJCH4r/QTMwR1lL+RRhXFHKns94UG3bViWW9bNrx7Qc4ps3iq8AoJJAVVy0QR7khX4vwKB2rRHRr6rsVOe42Mz1b/vU3z0LtyPn8s6Wtsa+r3nPPeFElGey6ezIG+IuF26tQ+HV2bp/Y6I0ihJYDBZ33F7sQqrNxXEP/9vpkJCv+5lRlNNlEtSNvHSwvlpvFjVXy1KxS6NC9fh3r9ZIgrJjVLYHeJ89eIR+ybh6mc56/geYgeasoOHnZW6YyPw/fKQJ0OqrpEFiOzfOKH2BZslrSwjBi28oV57TyOG/XsPZCLWyB2X6OeCX3iLqRAHDOwsckrUDvAzzwEn0kTs6bVmPmXTAnYxD07jkc1cXlTbNB8= MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 89b1762e-98a9-4829-0365-08d492168bc7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BY1PR0301MB0904; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB0904; 3:o940q+8mWlK6RNxCKb8rW7oGknWnOBc49cEhuRZsCKoqT+3V7d1lLH3urAE927ShViJvlGGdPIgQb+60WreYBKUDwIEHll5e/iW921sRQOSpHNlFEszxUyvq+xD/y2Sh9r6g8BFnOetApKY6JU9/j4GARD08oTRj2mDLWl+BZDM9BSGyd2OoBFEn1eWqUw6TJVsJ8mxBIad1g5FESc9CO/CU1SlomZeXjR3IHHd0Jiyr+WZpakAQf7jvhlDKZZDOD0ds/8u6pHLNc9Cx53VWKdmsuWuI4qKOqvLbU4HulqDqq7vDduCyoJH9mGDEOHscsj2Q/HtqKBnYGfS4duqpfd/sBnaInimpPHIyorkexiF0vpeOsTWcr2r4XXHy7wCpFoGQ5wS9vz/txeH5oOGuuY8doiqzWDL2lprcezZG3mlta3as5Wzp41BA4GYOimGl; 25:VbnLfhD66tlLfzZbdbm4ud5CGEMuZgcIf6S+gClAxuTuA6jbZpIJvvO3bmmMqRJae06rRL3Z67IVOQvbmyT/4AsR/1ZhIQJsJMBcP7YJ1JrqUaKszAcGVSBAt2gqAUGIVgGTh8zbRaSIwary31eNOcZ9cxI6m3AsgE9Vrrpv947kShVDjVcWQ92LF4r5KnioHIoNq6xpP/4g6YAPSMwSNP1hFjSvNEIc3bVhayARB8SkKhx2Ox3kK3TQPNrOIvMB8A7M1bC+XiREHpUsAiaGZDzBywu64Zv6d8qyZCSU4P9OMEFF+xgYx6k4HcpgrELfVookYrXwaYjk8ipZ7RgkUgZZEQAiVGtNTPrQuCXKIt/7dwF7JRcmo8szBuY0iV3weBiM2ACVBlek0nuRUjn1plnmYPgCVcffj4xnwP01z+eYqmRok54H4vcKVn3dFum/y/ba0ztHm80Uy03T05Ee2g== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB0904; 31:84DxIWmWfiW88Sd8w3lJr0B4IMK/uMQpp3SJBNwNWhIQwTpRl2p3FRzZ3x4ztJY1h6M/dClPEjhT7sP6zv9jJUXaY6ay/4dVfcFXWtVPIQNKVpa5rvIhX3vEsi+OJXqENz/cYGt07m74QNCaPc1WFGsGs6gLK+njxmVTgJHyMpQFkV1sxQ/CzI3upLZCcMrGIYng1Rjl7OfcZU61weKeN9VEC4hOx+ZRAMH2cussLG2S3jXDzUO1ylTwm7Si2nKA X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13015025)(8121501046)(5005006)(13017025)(13024025)(13023025)(13018025)(10201501046)(93006095)(93001095)(3002001)(6055026)(6096035)(20161123556025)(20161123563025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(20161123565025)(20161123561025); SRVR:BY1PR0301MB0904; BCL:0; PCL:0; RULEID:(400006); SRVR:BY1PR0301MB0904; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB0904; 4:/0I3k+f2N+/YcjQj/Bl2XyY7qB/R1r9WweVWucdxIlRnohkXiNO7yOB/g9lZFqbMZXaARnqZjs12Z/to++vF+ONCP0eNREyvSnSvSM/D+1sriV5NwBWjnD9qToTJ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UbrsrJ5Avq5ecqNVBXA34/Rxx/iAGf7mlvqf+Jg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB0904; 7:31RUcr8eVfRNKmJGmT6uP1UrBj3sBSZd9H169ILagKmP2/US3wxTixWp6HIJKXg5hjTrhNAlGy2f9TdgAQoGFaroCw0dZQapJcNvslQDgSJmgMKk/lvJ9xNm6QYA3TYcdCWbZ3fjc3ClFVlW6CrSHMPKewwcQoiwsjkV/7Hmap58TAICdnoN2SuVYr8nvjOJQ7zis+c4quEfqQbEARE36X90b1ceqPBQ9ozaNXQr51d/R0syqNreRmd/Ms2hotOBFauJ4E929+lJLfPTtoA9O5jbw1dc/smljUzHwJfOabsWCzfCQ1ptpAayPB0H+vpCfH0X36PLXOf7K5b8asFogA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2017 11:21:29.6377 (UTC) 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: BY1PR0301MB0904 Subject: [dpdk-dev] [RFC PATCH 2/5] kni: add support for promisc mode set 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: Wed, 03 May 2017 11:21:32 -0000 message to userspace on promisc mode change Signed-off-by: Hemant Agrawal --- .../linuxapp/eal/include/exec-env/rte_kni_common.h | 2 ++ lib/librte_eal/linuxapp/kni/kni_net.c | 20 ++++++++++++++++++++ lib/librte_kni/rte_kni.c | 5 +++++ lib/librte_kni/rte_kni.h | 3 +++ 4 files changed, 30 insertions(+) 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 e9fdc73..c04fefd 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 @@ -80,6 +80,7 @@ enum rte_kni_req_id { RTE_KNI_REQ_UNKNOWN = 0, RTE_KNI_REQ_CHANGE_MTU, RTE_KNI_REQ_CFG_NETWORK_IF, + RTE_KNI_REQ_CHANGE_PROMISC, RTE_KNI_REQ_CHANGE_MAC_ADDR, RTE_KNI_REQ_MAX, }; @@ -94,6 +95,7 @@ struct rte_kni_request { uint32_t new_mtu; /**< New MTU */ uint8_t if_up; /**< 1: interface up, 0: interface down */ uint8_t mac_addr[6]; /**< MAC address for interface */ + uint8_t promiscusity;/**< 1: promisc mode enable, 0: disable */ }; int32_t result; /**< Result for processing request */ } __attribute__((__packed__)); diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c index 866cbdd..e4a3296 100644 --- a/lib/librte_eal/linuxapp/kni/kni_net.c +++ b/lib/librte_eal/linuxapp/kni/kni_net.c @@ -44,6 +44,9 @@ #define WD_TIMEOUT 5 /*jiffies */ +#define PROMISC_ENABLE 1 +#define PROMISC_DISABLE 0 + #define KNI_WAIT_RESPONSE_TIMEOUT 300 /* 3 seconds */ /* typedef for rx function */ @@ -603,6 +606,22 @@ return (ret == 0) ? req.result : ret; } +static void +kni_net_set_promiscusity(struct net_device *netdev, int flags) +{ + struct rte_kni_request req; + struct kni_dev *kni = netdev_priv(netdev); + + memset(&req, 0, sizeof(req)); + req.req_id = RTE_KNI_REQ_CHANGE_PROMISC; + + if (netdev->flags & IFF_PROMISC) + req.promiscusity = PROMISC_ENABLE; + else + req.promiscusity= PROMISC_DISABLE; + kni_net_process_request(kni, &req); +} + /* * Checks if the user space application provided the resp message */ @@ -711,6 +730,7 @@ .ndo_open = kni_net_open, .ndo_stop = kni_net_release, .ndo_set_config = kni_net_config, + .ndo_change_rx_flags = kni_net_set_promiscusity, .ndo_start_xmit = kni_net_tx, .ndo_change_mtu = kni_net_change_mtu, .ndo_do_ioctl = kni_net_ioctl, diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index d5a717b..8ae632f 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -552,6 +552,11 @@ struct rte_kni * req->result = kni->ops.config_mac_address(kni->ops.port_id, req->mac_addr); break; + case RTE_KNI_REQ_CHANGE_PROMISC: /* Change PROMISCUOUS MODE */ + if (kni->ops.config_promiscusity) + req->result = kni->ops.config_promiscusity(kni->ops.port_id, + req->promiscusity); + break; default: RTE_LOG(ERR, KNI, "Unknown request id %u\n", req->req_id); req->result = -EINVAL; diff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h index 5d2a233..488db4b 100644 --- a/lib/librte_kni/rte_kni.h +++ b/lib/librte_kni/rte_kni.h @@ -74,6 +74,9 @@ struct rte_kni_ops { /* Pointer to function of configuring network interface */ int (*config_network_if)(uint8_t port_id, uint8_t if_up); + + /* Pointer to function of configuring promiscuous mode */ + int (*config_promiscusity)(uint8_t port_id, uint8_t to_on); /* Pointer to function of configuring mac address */ int (*config_mac_address)(uint8_t port_id, uint8_t mac_addr[6]); -- 1.9.1