From patchwork Tue Mar 31 07:50:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Savolainen, Petri \(Nokia - FI/Espoo\)" X-Patchwork-Id: 46576 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7D6F82159A for ; Tue, 31 Mar 2015 07:50:56 +0000 (UTC) Received: by wiaa2 with SMTP id a2sf2406780wia.1 for ; Tue, 31 Mar 2015 00:50:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:thread-topic :thread-index:date:message-id:references:in-reply-to:accept-language :content-language:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :content-type:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=Y0tYxrSwdWSUAvjkV2mzqAol+PA90lJGmQfXBwZ1YwY=; b=hvXja/1C2oXNBa2AgIn7DlaMBq6KWS1e4fR9xCSnE6AWORNOEuGgrNa/egNgzqHqsK Bkiwmp40cCOOeFxgqfiCVmH86V5dcPS1tNLwcF2dV72My2eqrkA0OuPhiW8besvCCVse +VJ+4HPer2R9X6zeU40ZJ9aAdDRLxB0u0OIgbxDKNZwxnC1IRnALV+T00oN4F5qSg7s2 8nMC78mpaZBdd93ewlKQbGhAc8PSgWauCzygWpKbqfMJTsM21CPkhOTDSiHK5eMOaJPs 31DG5tbqm1QRtKZuVpZKgtgxOCCr9Ef2CqtGexZixgt7lqOVgzlJcwcYQEWcTg2ULq82 2OIA== X-Gm-Message-State: ALoCoQkY8RhWgo2kQYpUkmWQgLwDtMQjIa6NeGjI2vCxxMOOZFlsxlcYllnwoWxbCi9RDIgAyckP X-Received: by 10.194.53.225 with SMTP id e1mr9465343wjp.4.1427788255824; Tue, 31 Mar 2015 00:50:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.163 with SMTP id az3ls615733lab.64.gmail; Tue, 31 Mar 2015 00:50:55 -0700 (PDT) X-Received: by 10.112.118.73 with SMTP id kk9mr5141553lbb.3.1427788255437; Tue, 31 Mar 2015 00:50:55 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id xk4si8688856lac.75.2015.03.31.00.50.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2015 00:50:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by labe2 with SMTP id e2so6399987lab.3 for ; Tue, 31 Mar 2015 00:50:55 -0700 (PDT) X-Received: by 10.112.29.36 with SMTP id g4mr21871539lbh.56.1427788255292; Tue, 31 Mar 2015 00:50:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.57.201 with SMTP id k9csp1640457lbq; Tue, 31 Mar 2015 00:50:54 -0700 (PDT) X-Received: by 10.140.33.164 with SMTP id j33mr45841526qgj.10.1427788253432; Tue, 31 Mar 2015 00:50:53 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j8si12992851qgf.57.2015.03.31.00.50.52; Tue, 31 Mar 2015 00:50:53 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 66D0764EEB; Tue, 31 Mar 2015 07:50:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=HTML_MESSAGE, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 69DBB64ED1; Tue, 31 Mar 2015 07:50:46 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 9FDD664EE2; Tue, 31 Mar 2015 07:50:44 +0000 (UTC) Received: from demumfd002.nsn-inter.net (demumfd002.nsn-inter.net [93.183.12.31]) by lists.linaro.org (Postfix) with ESMTPS id A1AF464ED1 for ; Tue, 31 Mar 2015 07:50:43 +0000 (UTC) Received: from demuprx017.emea.nsn-intra.net ([10.150.129.56]) by demumfd002.nsn-inter.net (8.14.3/8.14.3) with ESMTP id t2V7oeSE001219 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 31 Mar 2015 07:50:40 GMT Received: from DEMUHTC004.nsn-intra.net ([10.159.42.35]) by demuprx017.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id t2V7oerq015899 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 31 Mar 2015 09:50:40 +0200 Received: from DEMUMBX012.nsn-intra.net ([169.254.12.25]) by DEMUHTC004.nsn-intra.net ([10.159.42.35]) with mapi id 14.03.0224.002; Tue, 31 Mar 2015 09:50:39 +0200 From: "Savolainen, Petri (Nokia - FI/Espoo)" To: ext Bill Fischofer Thread-Topic: [lng-odp] [RFC 8/8] api: packet_io: renamed odp_pktio_promisc_mode_set Thread-Index: AQHQazakVbQ8JtrQ9UmyfUn+yN9gcJ02Ma1Q Date: Tue, 31 Mar 2015 07:50:40 +0000 Message-ID: References: <1427736187-13113-1-git-send-email-petri.savolainen@nokia.com> <1427736187-13113-8-git-send-email-petri.savolainen@nokia.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.159.42.112] MIME-Version: 1.0 X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-size: 19850 X-purgate-ID: 151667::1427788241-00007F9C-4AC75D58/0/0 Cc: LNG ODP Mailman List Subject: Re: [lng-odp] [RFC 8/8] api: packet_io: renamed odp_pktio_promisc_mode_set X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: petri.savolainen@nokia.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: ext Bill Fischofer [mailto:bill.fischofer@linaro.org] Sent: Tuesday, March 31, 2015 1:13 AM To: Savolainen, Petri (Nokia - FI/Espoo) Cc: LNG ODP Mailman List Subject: Re: [lng-odp] [RFC 8/8] api: packet_io: renamed odp_pktio_promisc_mode_set On Mon, Mar 30, 2015 at 12:23 PM, Petri Savolainen > wrote: Renamed to odp_pktio_ctrl_promisc_mode(). All interface level control function are prefixed with odp_pktio_ctrl_ to highlight that these operations may not be permitted on all interfaces. For example, virtual functions cannot change interface level settings, only physical functions can. Signed-off-by: Petri Savolainen > --- include/odp/api/packet_io.h | 30 +++++++++++++++++++----------- platform/linux-generic/odp_packet_io.c | 2 +- test/validation/odp_pktio.c | 4 ++-- 3 files changed, 22 insertions(+), 14 deletions(-) odp_pktio_ctrl_info(pktio, &ctrl_info); if (ctrl_info.promisc == 0) { printf(“No permission to set promisc mode\n”); return; } if (odp_pktio_ctrl_promisc_mode(pktio, 1)) printf(“Promisc mode set failed\n”); VS. if (odp_pktio_ctrl_promisc_mode(pktio, 1)) printf(“No permission to set promisc mode, or set failed\n”); This way the potentially not supported functions are grouped together. Other option would be to standadise the return value (-1 fail, -2 not supported) or use errno (-1 fail, errno== ENOSUPPORT). But I think it’s better to group and highlight this class of functions. All odp_xxx_set() functions would remain “supported” always. -Petri diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h index dc76270..3229d64 100644 --- a/include/odp/api/packet_io.h +++ b/include/odp/api/packet_io.h @@ -317,17 +317,6 @@ int odp_pktio_ctrl_info(odp_pktio_t pktio, odp_pktio_ctrl_info_t *info); int odp_pktio_mtu(odp_pktio_t pktio); /** - * Enable/Disable promiscuous mode on a packet IO interface. - * - * @param[in] pktio Packet IO handle. - * @param[in] enable 1 to enable, 0 to disable. - * - * @retval 0 on success - * @retval <0 on failure - */ -int odp_pktio_promisc_mode_set(odp_pktio_t pktio, odp_bool_t enable); - -/** * Determine if promiscuous mode is enabled for a packet IO interface. * * @param[in] pktio Packet IO handle. @@ -420,6 +409,25 @@ int odp_pktio_headroom_set(odp_pktio_t pktio, uint32_t headroom); */ uint64_t odp_pktio_to_u64(odp_pktio_t pktio); +/* + * Packet IO interface control + * --------------------------- + * + * Some functions may not be permitted on all interfaces + */ + +/** + * Enable/Disable promiscuous mode on a packet IO interface. + * + * @param[in] pktio Packet IO handle. + * @param[in] enable 1 to enable, 0 to disable. + * + * @retval 0 on success + * @retval <0 on failure + */ +int odp_pktio_ctrl_promisc_mode(odp_pktio_t pktio, odp_bool_t enable); This seems inconsistent with other getters/setters used throughout ODP. Why should these attributes have their own unique syntax instead of odp_pktio_promisc_mode() for the getter and odp_pktio_promisc_mode_set() for setter? The odp_pktio_ctrl_ API would be used to modifying the shared state of the interface (e.g. link up/down, or enable/disable promisc mode). Depending on the interface sharing (e.g. VF vs. PF), some of the API calls may not be supported on the interface the user has opened (a VF). User can call odp_pktio_ctrl_info() to check which ctrl API functions are permitted.