[dpdk-dev] [PATCH 5/9] net/mlx5: add port ID item to Direct Verbs
Ori Kam
orika at mellanox.com
Thu Apr 18 06:43:19 CEST 2019
Hi Yongseok,
PSB
> -----Original Message-----
> From: Yongseok Koh
> Sent: Thursday, April 18, 2019 3:20 AM
> To: Ori Kam <orika at mellanox.com>
> Cc: Shahaf Shuler <shahafs at mellanox.com>; Matan Azrad
> <matan at mellanox.com>; Slava Ovsiienko <viacheslavo at mellanox.com>; Moti
> Haimovsky <motih at mellanox.com>; dev at dpdk.org
> Subject: Re: [PATCH 5/9] net/mlx5: add port ID item to Direct Verbs
>
> On Sun, Apr 14, 2019 at 09:12:33PM +0000, Ori Kam wrote:
> > Adds the port ID item to the DV steering code.
> >
> > Signed-off-by: Ori Kam <orika at mellanox.com>
> > ---
> > drivers/net/mlx5/mlx5_flow_dv.c | 86 ++++++++++++++++++++++++++++++--
> ---------
> > 1 file changed, 63 insertions(+), 23 deletions(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> > index fedc6cb..e66ee34 100644
> > --- a/drivers/net/mlx5/mlx5_flow_dv.c
> > +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> > @@ -3095,6 +3095,64 @@ struct field_modify_info modify_tcp[] = {
> > }
> > }
> >
> > +/**
> > + * Add source vport match to the specified matcher.
> > + *
> > + * @param[in, out] matcher
> > + * Flow matcher.
> > + * @param[in, out] key
> > + * Flow matcher value.
> > + * @param[in] port
> > + * Source vport value to match
> > + * @param[in] mask
> > + * Mask
> > + */
> > +static void
> > +flow_dv_translate_item_source_vport(void *matcher, void *key,
> > + int16_t port, uint16_t mask)
> > +{
> > + void *misc_m = MLX5_ADDR_OF(fte_match_param, matcher,
> misc_parameters);
> > + void *misc_v = MLX5_ADDR_OF(fte_match_param, key,
> misc_parameters);
> > +
> > + MLX5_SET(fte_match_set_misc, misc_m, source_port, mask);
> > + MLX5_SET(fte_match_set_misc, misc_v, source_port, port);
> > +}
> > +
> > +/**
> > + * Translate port-id item to eswitch match on port-id.
> > + *
> > + * @param[in] dev
> > + * The devich to configure through.
> > + * @param[in, out] matcher
> > + * Flow matcher.
> > + * @param[in, out] key
> > + * Flow matcher value.
> > + * @param[in] item
> > + * Flow pattern to translate.
> > + *
> > + * @return
> > + * 0 on success, a negative errno value otherwise.
> > + */
> > +static int
> > +flow_dv_eswitch_translate_item_port_id(struct rte_eth_dev *dev,
>
> Why did you put _eswitch in the function name unlike
> flow_dv_validate_item_port_id()? It sounds awkward.
>
Right will fix.
> > + void *matcher, void *key,
> > + const struct rte_flow_item *item)
> > +{
> > + const struct rte_flow_item_port_id *pid_m = item ? item->mask :
> NULL;
> > + const struct rte_flow_item_port_id *pid_v = item ? item->spec : NULL;
> > + uint16_t mask, val, id;
> > + int ret;
> > +
> > + mask = pid_m ? pid_m->id : 0xffff;
> > + id = pid_v ? pid_v->id : dev->data->port_id;
> > + id = mask ? id : dev->data->port_id;
>
> Again, doesn't zero mask mean 'any' value?
>
Will double check. In any case I think we can agree that it doesn't make sense to
Have rules for different flows. So even if the Nic allows we can disable this feature.
What do you think?
> Thanks,
> Yongseok
>
> > + ret = mlx5_port_to_eswitch_info(id, NULL, &val);
> > + if (ret)
> > + return ret;
> > + flow_dv_translate_item_source_vport(matcher, key, val, mask);
> > + return 0;
> > +}
> > +
> > static uint32_t matcher_zero[MLX5_ST_SZ_DW(fte_match_param)] = { 0 };
> >
> > #define HEADER_IS_ZERO(match_criteria, headers)
> \
> > @@ -3305,29 +3363,6 @@ struct field_modify_info modify_tcp[] = {
> > }
> >
> > /**
> > - * Add source vport match to the specified matcher.
> > - *
> > - * @param[in, out] matcher
> > - * Flow matcher.
> > - * @param[in, out] key
> > - * Flow matcher value.
> > - * @param[in] port
> > - * Source vport value to match
> > - * @param[in] mask
> > - * Mask
> > - */
> > -static void
> > -flow_dv_translate_item_source_vport(void *matcher, void *key,
> > - int16_t port, uint16_t mask)
> > -{
> > - void *misc_m = MLX5_ADDR_OF(fte_match_param, matcher,
> misc_parameters);
> > - void *misc_v = MLX5_ADDR_OF(fte_match_param, key,
> misc_parameters);
> > -
> > - MLX5_SET(fte_match_set_misc, misc_m, source_port, mask);
> > - MLX5_SET(fte_match_set_misc, misc_v, source_port, port);
> > -}
> > -
> > -/**
> > * Find existing tag resource or create and register a new one.
> > *
> > * @param dev[in, out]
> > @@ -3733,6 +3768,11 @@ struct field_modify_info modify_tcp[] = {
> > void *match_value = dev_flow->dv.value.buf;
> >
> > switch (items->type) {
> > + case RTE_FLOW_ITEM_TYPE_PORT_ID:
> > + flow_dv_eswitch_translate_item_port_id
> > + (dev, match_mask, match_value,
> items);
> > + last_item = MLX5_FLOW_ITEM_PORT_ID;
> > + break;
> > case RTE_FLOW_ITEM_TYPE_ETH:
> > flow_dv_translate_item_eth(match_mask,
> match_value,
> > items, tunnel);
> > --
> > 1.8.3.1
> >
More information about the dev
mailing list