[{"id":1778444,"web_url":"http://patchwork.ozlabs.org/comment/1778444/","msgid":"<2EF2F5C0CC56984AA024D0B180335FCB52569090@IRSMSX102.ger.corp.intel.com>","list_archive_url":null,"date":"2017-10-02T16:23:52","subject":"Re: [ovs-dev] [PATCH v3 1/9] dpif-netdev: associate flow with a\n\tmark id","submitter":{"id":67440,"url":"http://patchwork.ozlabs.org/api/people/67440/","name":"Chandran, Sugesh","email":"sugesh.chandran@intel.com"},"content":"Regards\n_Sugesh\n\n\n> -----Original Message-----\n> From: Yuanhan Liu [mailto:yliu@fridaylinux.org]\n> Sent: Tuesday, September 26, 2017 6:37 AM\n> To: dev@openvswitch.org\n> Cc: Finn Christensen <fc@napatech.com>; Darrell Ball <dball@vmware.com>;\n> Chandran, Sugesh <sugesh.chandran@intel.com>; Simon Horman\n> <simon.horman@netronome.com>; Yuanhan Liu <yliu@fridaylinux.org>\n> Subject: [PATCH v3 1/9] dpif-netdev: associate flow with a mark id\n> \n> This patch associate a flow with a mark id (a uint32_t number) by a direct array.\n> The array is initiated with 1024 slots at the begninning, and it will be enlarged\n> when it's not big enough.  The mark id is allocated with the help of id-pool.\n> \n> It re-uses the flow API (more precisely, the ->flow_put method) to setup the hw\n> flow. The flow_put implementation then is supposed to create a flow with\n> MARK action for current stage, which is, only partial offload is supported.\n> \n> Co-authored-by: Finn Christensen <fc@napatech.com>\n> Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org>\n> Signed-off-by: Finn Christensen <fc@napatech.com>\n> ---\n>  lib/dpif-netdev.c | 140\n> ++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>  lib/netdev.h      |   6 +++\n>  2 files changed, 146 insertions(+)\n> \n> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 071ec14..f417b25 100644\n> --- a/lib/dpif-netdev.c\n> +++ b/lib/dpif-netdev.c\n> @@ -453,6 +453,9 @@ struct dp_netdev_flow {\n>      struct ovs_refcount ref_cnt;\n> \n>      bool dead;\n> +    bool has_mark;               /* A flag to tell whether this flow has a\n> +                                    valid mark asscoiated with it. */\n> +    uint32_t mark;               /* Unique flow mark assiged to a flow */\n> \n>      /* Statistics. */\n>      struct dp_netdev_flow_stats stats;\n> @@ -1833,6 +1836,82 @@ dp_netdev_pmd_find_dpcls(struct\n> dp_netdev_pmd_thread *pmd,\n>      return cls;\n>  }\n> \n> +/*\n> + * An array to map from the flow mark (the index) to dp netdev flow.\n> + * Initial size is set to 1024, it will be resized when it's not\n> + * big enough.\n> + */\n> +struct flow_mark_map {\n> +    size_t max;\n> +    struct ovs_mutex mutex;\n> +    struct id_pool *mark_pool;\n> +    struct dp_netdev_flow **flows;\n> +};\n[Sugesh] Is it good to make this map is for per port/device.?\nThe reason being, any access to this map should be mutex protected.\nI feel there will be contention if multiple PMD threads trying to program the flows, even\nthough the flows are in different devices. It can also happen with revalidator threads on flow delete.\n\n> +\n> +static struct flow_mark_map flow_mark_map = {\n> +    .max = 1024,\n> +    .mutex = OVS_MUTEX_INITIALIZER,\n> +};\n> +\n\n[snip]\n> --\n> 2.7.4","headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","ovs-dev@mail.linuxfoundation.org"],"Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","Received":["from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y5SCv2XQXz9t6m\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  3 Oct 2017 03:24:11 +1100 (AEDT)","from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 898A6B13;\n\tMon,  2 Oct 2017 16:23:58 +0000 (UTC)","from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 4261EB09\n\tfor <dev@openvswitch.org>; Mon,  2 Oct 2017 16:23:57 +0000 (UTC)","from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id 54916FC\n\tfor <dev@openvswitch.org>; Mon,  2 Oct 2017 16:23:56 +0000 (UTC)","from orsmga004.jf.intel.com ([10.7.209.38])\n\tby orsmga104.jf.intel.com with ESMTP; 02 Oct 2017 09:23:55 -0700","from irsmsx154.ger.corp.intel.com ([163.33.192.96])\n\tby orsmga004.jf.intel.com with ESMTP; 02 Oct 2017 09:23:53 -0700","from irsmsx102.ger.corp.intel.com ([169.254.2.180]) by\n\tIRSMSX154.ger.corp.intel.com ([169.254.12.83]) with mapi id\n\t14.03.0319.002; Mon, 2 Oct 2017 17:23:52 +0100"],"X-Greylist":"domain auto-whitelisted by SQLgrey-1.7.6","X-ExtLoop1":"1","X-IronPort-AV":"E=Sophos;i=\"5.42,470,1500966000\"; d=\"scan'208\";a=\"134373369\"","From":"\"Chandran, Sugesh\" <sugesh.chandran@intel.com>","To":"Yuanhan Liu <yliu@fridaylinux.org>, \"dev@openvswitch.org\"\n\t<dev@openvswitch.org>","Thread-Topic":"[PATCH v3 1/9] dpif-netdev: associate flow with a mark id","Thread-Index":"AQHTNomsC38DMICy9Ui5c/90J/5zUqLQsNcg","Date":"Mon, 2 Oct 2017 16:23:52 +0000","Message-ID":"<2EF2F5C0CC56984AA024D0B180335FCB52569090@IRSMSX102.ger.corp.intel.com>","References":"<1506404199-23579-1-git-send-email-yliu@fridaylinux.org>\n\t<1506404199-23579-2-git-send-email-yliu@fridaylinux.org>","In-Reply-To":"<1506404199-23579-2-git-send-email-yliu@fridaylinux.org>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","dlp-product":"dlpe-windows","dlp-version":"11.0.0.116","dlp-reaction":"no-action","x-originating-ip":"[163.33.239.182]","MIME-Version":"1.0","X-Spam-Status":"No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,\n\tRP_MATCHES_RCVD autolearn=disabled version=3.3.1","X-Spam-Checker-Version":"SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org","Cc":"Simon Horman <simon.horman@netronome.com>","Subject":"Re: [ovs-dev] [PATCH v3 1/9] dpif-netdev: associate flow with a\n\tmark id","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.12","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"ovs-dev-bounces@openvswitch.org","Errors-To":"ovs-dev-bounces@openvswitch.org"}}]