From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30045.outbound.protection.outlook.com [40.107.3.45]) by dpdk.org (Postfix) with ESMTP id 0C61D1BEE5 for ; Wed, 4 Jul 2018 10:34:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R7Wpp7NKHEx6hDQnbCTojLnO8eoFRrcSiVrzqLya++4=; b=t9TwAqNrlu52D6gDCPAmBTXf33gwFpAlUWxv2b6Iu0QhfSFKeRNn05z5QToiRkHRKfU70agOYzzZj7OfWQmqGImVA1xohSyJdARGWbfkr5PLhe/dz8cJ2jkH/r95djKnRDCXgaLwci233Jed+LUVkQLL1xkgzC2p0uk0CGNRb7Q= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from minint-98vp2qg (73.222.116.174) by HE1PR0501MB2041.eurprd05.prod.outlook.com (2603:10a6:3:35::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.26; Wed, 4 Jul 2018 08:34:36 +0000 Date: Wed, 4 Jul 2018 01:34:19 -0700 From: Yongseok Koh To: Nelio Laranjeiro Cc: dev@dpdk.org, Adrien Mazarguil Message-ID: <20180704083418.GA45405@minint-98vp2qg> References: <90a73b5f33e147ffa3a668f5d19410de17f96045.1530111623.git.nelio.laranjeiro@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <90a73b5f33e147ffa3a668f5d19410de17f96045.1530111623.git.nelio.laranjeiro@6wind.com> User-Agent: Mutt/1.9.3 (2018-01-21) X-Originating-IP: [73.222.116.174] X-ClientProxiedBy: MWHPR2001CA0003.namprd20.prod.outlook.com (2603:10b6:301:15::13) To HE1PR0501MB2041.eurprd05.prod.outlook.com (2603:10a6:3:35::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 30e9d7ed-6c2a-45ce-4579-08d5e188fa2a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:HE1PR0501MB2041; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2041; 3:bW32/MBdezI/g61Tzvqv1usKLqNl+kQ1vLJT8hoivqVlCZK7cUwVF+iE4vBUQ4tYUm0l7ByMbLJVszQ7SwpVSCSAfINAK0ETDVy6m8qNmTMXnAxbqmngaH73aFyRvcLemA2J95FzDAk/f+JgpjICqEZgo/i6417Xb7Gmy+frU4m73xL+et5ptXzSChQkcjvMVIyLu78OtaDUAJOddc2o+rVa5IfLZdIFCFGqEcigdubcMifNbez2DjqjkHCQRa5q; 25:PmadzVVL6y7sLeQ99QLnsFNSu/pKog7obnWz6cHg7qxT/iuaFvYTiBO7BypGtmyo12+ORvbAzwLvIyVS8Cu2luoKbdtG9pab7kqip/xpNHIsMf581+HlG3l1jimYulV2vIJopw5kVmLiPxVv1iPH9aIKH9TNIaKwzgr940Z9iUwnCVYABzANlK3zilCxKUZJq0D8vxv6i5b1AuVgEhT+acjmOn+6bXiCg37kSIbYC+nEs+PMT0c1VbrsTl9pE0+DaBOr5Bz0iSzl8XAdJRQCxLoYGZToz6xL0G8r3FcFST3WB3IBCJbWg3OAv1L50opXyHqXhXVu5TNnLtOwiJgKRg==; 31:14HN8nro9uhWUz3SKoNCnQCJfrXgbol9LN9N57NnDg+Y7n1ArXkZ24haVj0wqejY2ceD6xjE8XEgKMwtABpkB/gCefa/rM1Pu5UbzzUp87yd5z4uL1aL4eFO+5Gt5d8xRSh2uvOgWgkxVlEXwXCB2ZjeNxIzzNonI6Kx2k69PuuSicBS8YPKpzM9ZPjtZmJBQ9JMiXo6je+XcigU220F6dDPOb+Xu21M7e5TE5LOpRo= X-MS-TrafficTypeDiagnostic: HE1PR0501MB2041: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2041; 20:GfFYwJmEUYfeuIuwqCFdjuM+VR/1cwj10z1GrwwUGyqqjGhHLo6IOFN3dR+eFslT7ynGfhRs91tTLmn3M5LP5AkGxvWFWZDLmtA1cjXB4bqqWj7d/EgkIZyvnDA+5MM1dyU+j8z04xD2MHcUpn9HuVkQ5f1peKvj7BQQ1XxWODYYKOhJNT4M8MFt1QFV/Ow1CK45Z64MVbZ5GMIIkhkRy/xkfqRoSzhMEwWyswyx4m/wf/ZfBSgddMMjnGy5KBqyWI1Q01FbxxDpeyHRtzy4f6HjYSHF4m3IhS2bZtAEBTJYekQUR4jCUWzQMDcSVgJkbI98mvkMYxgY/nyx07ByRYHcvvAzhXfnZnH6J+LzmHb2oi1GWLA7vMvd/wMlMYIeD5j6XSN6ubAJ2nmkuPtEWtsTDEddroCQea24JggFcMM/UQ2jO+TTS9SH34UwLo9ygvzQ0+VJGuRTa3Dx9nksgSB8FG9YU9FDACDZvPL3fCVSsRofyFQ8Qi+rqPSadlTa; 4:YQ3VfdxUbVwng5SjY3r8XhwBFs0SCQ3GB+0XNtG91Uy4r44MlypFJjQKRk+EXaxMYTyFeBnMxvtJxHMf1WO9E8EAe9PjQKlY5w/EzxgtLMtxKgDbO/upxfZUJZ4tBrcAMB1BhbMACQzIwvb7UHhroWpH2ir+XA+5r5w0gG6c+pHdcjL8sZeo+fT8s/jmszeqL4Rk695NFZf5E7QVsY1zdfd2he3baneopyGfgS3xDiE8AZPLN6KX3QfeB3mGyOMNp00PtDvDsy3cR2RsVkpy0prH6efcuP0XNPaL94zVD5P7fJAtWjpRdHmN+LgvLACN X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:HE1PR0501MB2041; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2041; X-Forefront-PRVS: 0723A02764 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(136003)(346002)(376002)(396003)(189003)(199004)(6496006)(7736002)(8936002)(105586002)(106356001)(16586007)(68736007)(16526019)(52116002)(186003)(316002)(58126008)(386003)(6916009)(50466002)(33896004)(6666003)(2906002)(5660300001)(76176011)(66066001)(47776003)(33656002)(1076002)(478600001)(33716001)(14444005)(11346002)(86362001)(486006)(6246003)(3846002)(26005)(53936002)(9686003)(446003)(25786009)(476003)(55016002)(305945005)(23726003)(4326008)(229853002)(81166006)(8676002)(81156014)(97736004)(956004)(6116002)(18370500001)(107986001)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2041; H:minint-98vp2qg; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0501MB2041; 23:rMSoZJIGkdQ4O94zpWN2E08yUC4GFYypjZvqN/b?= =?us-ascii?Q?WquR2VPAN/9/W8Wgjxvgp1wJjmpDjn47Z+pMLe4TpgZSqCjD8mkzG6nvmDQ+?= =?us-ascii?Q?2Kho+l3hER/kUB9s5KfUg3IBgHDn5INE59REsORJ3jafwJHYFpLPU+T/ShJl?= =?us-ascii?Q?Tbb1yNNbIp7rpFZD9oRwniBT2tkVZG17c9wH9YYiKjHqBx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0Gza8MV9k85Xuoi8xlOH7x4bvKYmQibW6A8CyA35PnyNZ6Bd4PZlMvr44pCuUL2ii8SvHgwudNgeFo4zxrgT5izj6rlgDZGkixi3C/ZjtLAVTCdyA83E8GIrkBFOdiewcOTBpC2pPAXF7SPXKyFRw==; 5:lA0R+PJdnrDFotZUbTKg/nPYOMY0WaAxT5a+Jvdj3RMumMK7eoawWwL67ijb5GCn3sztvkt6RBcmZh+XyNgCDbV5WiLrBECU59uNDG6r3K9D5Lfn7psN5Xr5qFd8wwfqMy1jgWLRr374CoZ9n+PtG7CfdX9xdXme0nNI14kRzA8=; 24:qlGJibyCxhlCJSEmOCeF7cBKTL3lgXjVEGtzXvg/5ivGvV02BCNwEOCqC1y40Twqh78Fv2lx0Vq7GGli/1Z95M/lORPDPZpLWHxFMe/07XE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2041; 7:rFrWMNuaB8UvuhAN+pJTbHawlq41icCrV3jrI7dvlxgBUpDv39TQA7hKExfN3dw4wMcW/OWfI89WsuNoOUMp7eI53SYprPk38P0SgrTpfJI6tiNePSrF4ptNHSZqexfQX2u6ZRCiLZ+ENIwtQQ+f96twkkPMWGrq/KK/JvsRNZ2noS8LxqFuYIN2uLn6cDHVhrt2Q6UarZb+j7ONvJwTBI/w9DeKY3jywu38w25xO8WSmh4ZYlQuAjaP/Vvawbzk X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2018 08:34:36.0819 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 30e9d7ed-6c2a-45ce-4579-08d5e188fa2a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2041 Subject: Re: [dpdk-dev] [PATCH v2 12/20] net/mlx5: add mark/flag flow action 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, 04 Jul 2018 08:34:40 -0000 On Wed, Jun 27, 2018 at 05:07:44PM +0200, Nelio Laranjeiro wrote: > Signed-off-by: Nelio Laranjeiro > --- > drivers/net/mlx5/mlx5_flow.c | 209 +++++++++++++++++++++++++++++++++++ > 1 file changed, 209 insertions(+) > > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index 57f072c03..a39157533 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -52,6 +52,10 @@ extern const struct eth_dev_ops mlx5_dev_ops_isolate; > #define MLX5_FLOW_FATE_DROP (1u << 0) > #define MLX5_FLOW_FATE_QUEUE (1u << 1) > > +/* Modify a packet. */ > +#define MLX5_FLOW_MOD_FLAG (1u << 0) > +#define MLX5_FLOW_MOD_MARK (1u << 1) > + > /** Handles information leading to a drop fate. */ > struct mlx5_flow_verbs { > unsigned int size; /**< Size of the attribute. */ > @@ -70,6 +74,8 @@ struct rte_flow { > struct rte_flow_attr attributes; /**< User flow attribute. */ > uint32_t layers; > /**< Bit-fields of present layers see MLX5_FLOW_ITEMS_*. */ > + uint32_t modifier; > + /**< Bit-fields of present modifier see MLX5_FLOW_MOD_*. */ Why do you think flag and mark modify a packet? I don't think modifier is an appropriate name. > uint32_t fate; > /**< Bit-fields of present fate see MLX5_FLOW_FATE_*. */ > struct mlx5_flow_verbs verbs; /* Verbs flow. */ > @@ -954,6 +960,12 @@ mlx5_flow_action_drop(const struct rte_flow_action *actions, > actions, > "multiple fate actions are not" > " supported"); > + if (flow->modifier & (MLX5_FLOW_MOD_FLAG | MLX5_FLOW_MOD_MARK)) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ACTION, > + actions, > + "drop is not compatible with" > + " flag/mark action"); > if (size < flow_size) > mlx5_flow_spec_verbs_add(flow, &drop, size); > flow->fate |= MLX5_FLOW_FATE_DROP; > @@ -1007,6 +1019,144 @@ mlx5_flow_action_queue(struct rte_eth_dev *dev, > return 0; > } > > +/** > + * Validate action flag provided by the user. > + * > + * @param actions > + * Pointer to flow actions array. > + * @param flow > + * Pointer to the rte_flow structure. > + * @param flow_size > + * Size in bytes of the available space for to store the flow information. > + * @param error > + * Pointer to error structure. > + * > + * @return > + * size in bytes necessary for the conversion, a negative errno value > + * otherwise and rte_errno is set. Like I asked for the previous patches, please be more verbose for function description and explanation of args and return value. > + */ > +static int > +mlx5_flow_action_flag(const struct rte_flow_action *actions, > + struct rte_flow *flow, const size_t flow_size, > + struct rte_flow_error *error) > +{ > + unsigned int size = sizeof(struct ibv_flow_spec_action_tag); > + struct ibv_flow_spec_action_tag tag = { > + .type = IBV_FLOW_SPEC_ACTION_TAG, > + .size = size, > + .tag_id = mlx5_flow_mark_set(MLX5_FLOW_MARK_DEFAULT), > + }; > + > + if (flow->modifier & MLX5_FLOW_MOD_FLAG) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ACTION, > + actions, > + "flag action already present"); > + if (flow->fate & MLX5_FLOW_FATE_DROP) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ACTION, > + actions, > + "flag is not compatible with drop" > + " action"); > + if (flow->modifier & MLX5_FLOW_MOD_MARK) > + return 0; > + flow->modifier |= MLX5_FLOW_MOD_FLAG; > + if (size <= flow_size) > + mlx5_flow_spec_verbs_add(flow, &tag, size); > + return size; > +} > + > +/** > + * Update verbs specification to modify the flag to mark. > + * > + * @param flow > + * Pointer to the rte_flow structure. > + * @param mark_id > + * Mark identifier to replace the flag. > + */ > +static void > +mlx5_flow_verbs_mark_update(struct rte_flow *flow, uint32_t mark_id) > +{ > + struct ibv_spec_header *hdr; > + int i; > + > + /* Update Verbs specification. */ > + hdr = (struct ibv_spec_header *)flow->verbs.specs; > + for (i = 0; i != flow->verbs.attr->num_of_specs; ++i) { flow->verbs.attr/specs can be null in case of validation call. But you don't need to fix it because it is anyway changed and fixed when you add RSS action. > + if (hdr->type == IBV_FLOW_SPEC_ACTION_TAG) { > + struct ibv_flow_spec_action_tag *t = > + (struct ibv_flow_spec_action_tag *)hdr; > + > + t->tag_id = mlx5_flow_mark_set(mark_id); > + } > + hdr = (struct ibv_spec_header *)((uintptr_t)hdr + hdr->size); > + } > +} > + > +/** > + * Validate action mark provided by the user. > + * > + * @param actions > + * Pointer to flow actions array. > + * @param flow > + * Pointer to the rte_flow structure. > + * @param flow_size[in] > + * Size in bytes of the available space for to store the flow information. > + * @param error > + * Pointer to error structure. > + * > + * @return > + * size in bytes necessary for the conversion, a negative errno value > + * otherwise and rte_errno is set. > + */ > +static int > +mlx5_flow_action_mark(const struct rte_flow_action *actions, > + struct rte_flow *flow, const size_t flow_size, > + struct rte_flow_error *error) > +{ > + const struct rte_flow_action_mark *mark = actions->conf; > + unsigned int size = sizeof(struct ibv_flow_spec_action_tag); > + struct ibv_flow_spec_action_tag tag = { > + .type = IBV_FLOW_SPEC_ACTION_TAG, > + .size = size, > + }; > + > + if (!mark) > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, > + actions, > + "configuration cannot be null"); > + if (mark->id >= MLX5_FLOW_MARK_MAX) > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION_CONF, > + &mark->id, > + "mark must be between 0 and" > + " 16777199"); Use %d and (MLX5_FLOW_MARK_MAX - 1), instead of fixed string. > + if (flow->modifier & MLX5_FLOW_MOD_MARK) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ACTION, > + actions, > + "mark action already present"); > + if (flow->fate & MLX5_FLOW_FATE_DROP) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ACTION, > + actions, > + "mark is not compatible with drop" > + " action"); > + if (flow->modifier & MLX5_FLOW_MOD_FLAG) { > + mlx5_flow_verbs_mark_update(flow, mark->id); > + size = 0; /**< Only an update is done in the specification. */ > + } else { > + tag.tag_id = mlx5_flow_mark_set(mark->id); > + if (size <= flow_size) { > + tag.tag_id = mlx5_flow_mark_set(mark->id); > + mlx5_flow_spec_verbs_add(flow, &tag, size); > + } > + } > + flow->modifier |= MLX5_FLOW_MOD_MARK; > + return size; > +} > + > /** > * Validate actions provided by the user. > * > @@ -1039,6 +1189,14 @@ mlx5_flow_actions(struct rte_eth_dev *dev, > switch (actions->type) { > case RTE_FLOW_ACTION_TYPE_VOID: > break; > + case RTE_FLOW_ACTION_TYPE_FLAG: > + ret = mlx5_flow_action_flag(actions, flow, remain, > + error); > + break; > + case RTE_FLOW_ACTION_TYPE_MARK: > + ret = mlx5_flow_action_mark(actions, flow, remain, > + error); > + break; > case RTE_FLOW_ACTION_TYPE_DROP: > ret = mlx5_flow_action_drop(actions, flow, remain, > error); > @@ -1122,6 +1280,23 @@ mlx5_flow_merge(struct rte_eth_dev *dev, struct rte_flow *flow, > return size; > } > > +/** > + * Mark the Rx queues mark flag if the flow has a mark or flag modifier. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param flow > + * Pointer to flow structure. > + */ > +static void > +mlx5_flow_rxq_mark(struct rte_eth_dev *dev, struct rte_flow *flow) > +{ > + struct priv *priv = dev->data->dev_private; > + > + (*priv->rxqs)[flow->queue]->mark |= > + flow->modifier & (MLX5_FLOW_MOD_FLAG | MLX5_FLOW_MOD_MARK); This has to be !!(...) as rxq->mark has only 1 bit. But, it is also fixed by coming RSS patches. Not sure what's benefit of splitting patches in this way. > +} > + > /** > * Validate a flow supported by the NIC. > * > @@ -1281,6 +1456,7 @@ mlx5_flow_list_create(struct rte_eth_dev *dev, > if (ret < 0) > goto error; > } > + mlx5_flow_rxq_mark(dev, flow); > TAILQ_INSERT_TAIL(list, flow, next); > return flow; > error: > @@ -1323,8 +1499,31 @@ static void > mlx5_flow_list_destroy(struct rte_eth_dev *dev, struct mlx5_flows *list, > struct rte_flow *flow) > { > + struct priv *priv = dev->data->dev_private; > + struct rte_flow *rflow; > + const uint32_t mask = MLX5_FLOW_MOD_FLAG & MLX5_FLOW_MOD_MARK; > + int mark = 0; > + > mlx5_flow_fate_remove(dev, flow); > TAILQ_REMOVE(list, flow, next); > + if (!(flow->modifier & mask)) { > + rte_free(flow); > + return; > + } > + /* > + * When a flow is removed and this flow has a flag/mark modifier, all > + * flows needs to be parse to verify if the Rx queue use by the flow > + * still need to track the flag/mark request. > + */ When a flow is created, mlx5_flow_rxq_mark() is called. Is there a specific reason for not writing a separate function in order to drop rxq->mark bit? > + TAILQ_FOREACH(rflow, &priv->flows, next) { > + if (!(rflow->modifier & mask)) > + continue; > + if (flow->queue == rflow->queue) { > + mark = 1; > + break; > + } > + } > + (*priv->rxqs)[flow->queue]->mark = !!mark; mark can be either 0 or 1, then !!mark == mark anyway. > rte_free(flow); > } > > @@ -1358,10 +1557,19 @@ mlx5_flow_list_flush(struct rte_eth_dev *dev, struct mlx5_flows *list) > void > mlx5_flow_stop(struct rte_eth_dev *dev, struct mlx5_flows *list) > { > + struct priv *priv = dev->data->dev_private; > struct rte_flow *flow; > + unsigned int i; > + unsigned int idx; > > TAILQ_FOREACH_REVERSE(flow, list, mlx5_flows, next) > mlx5_flow_fate_remove(dev, flow); > + for (idx = 0, i = 0; idx != priv->rxqs_n; ++i) { > + if (!(*priv->rxqs)[idx]) > + continue; > + (*priv->rxqs)[idx]->mark = 0; > + ++idx; > + } Same question here but looks like this part is being moved to mlx5_flow_rxqs_clear() in the future. > } > > /** > @@ -1386,6 +1594,7 @@ mlx5_flow_start(struct rte_eth_dev *dev, struct mlx5_flows *list) > ret = mlx5_flow_fate_apply(dev, flow, &error); > if (ret < 0) > goto error; > + mlx5_flow_rxq_mark(dev, flow); > } > return 0; > error: > -- > 2.18.0 >