[dpdk-dev] [PATCH v5 11/17] net/ionic: add Rx filters support
Raslan Darawsheh
rasland at mellanox.com
Tue Jan 21 08:43:48 CET 2020
Hi,
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit at intel.com>
> Sent: Monday, January 20, 2020 6:58 PM
> To: Alfredo Cardigliano <cardigliano at ntop.org>; John McNamara
> <john.mcnamara at intel.com>; Marko Kovacevic
> <marko.kovacevic at intel.com>
> Cc: dev at dpdk.org; Raslan Darawsheh <rasland at mellanox.com>
> Subject: Re: [dpdk-dev] [PATCH v5 11/17] net/ionic: add Rx filters support
>
> On 1/19/2020 3:53 PM, Alfredo Cardigliano wrote:
> > Add support for managing RX filters based on MAC and VLAN.
> > Hardware cannot provide the list of filters, thus we keep
> > a local list.
> > Add support for promisc and allmulticast modes.
> >
> > Signed-off-by: Alfredo Cardigliano <cardigliano at ntop.org>
> > Reviewed-by: Shannon Nelson <snelson at pensando.io>
>
> <...>
>
> > +int
> > +ionic_rx_filter_save(struct ionic_lif *lif, uint32_t flow_id,
> > + uint16_t rxq_index, struct ionic_admin_ctx *ctx)
> > +{
> > + struct ionic_rx_filter *f;
> > + uint32_t key;
> > +
> > + f = rte_zmalloc("ionic", sizeof(*f), 0);
> > +
> > + if (!f)
> > + return -ENOMEM;
> > +
> > + f->flow_id = flow_id;
> > + f->filter_id = ctx->comp.rx_filter_add.filter_id;
> > + f->rxq_index = rxq_index;
> > + memcpy(&f->cmd, &ctx->cmd, sizeof(f->cmd));
> > +
> > + switch (f->cmd.match) {
> > + case IONIC_RX_FILTER_MATCH_VLAN:
> > + key = f->cmd.vlan.vlan & IONIC_RX_FILTER_HLISTS_MASK;
> > + break;
> > + case IONIC_RX_FILTER_MATCH_MAC:
> > + key = *(uint32_t *)f->cmd.mac.addr &
> > + IONIC_RX_FILTER_HLISTS_MASK;
>
> Raslan reported a build error on this line [1] with gcc 5.4-6ubuntu. I will
> update the code as [2] please verify the result in next-net.
>
> @Raslan, I can't re-procude the warning, can you please re-test the next-net
> after change?
>
I've just verified that with this fix we don't have this error anymore.
> [1]
> /tmp/dpdk/drivers/net/ionic/ionic_rx_filter.c: In function
> 'ionic_rx_filter_save':
> /tmp/dpdk/drivers/net/ionic/ionic_rx_filter.c:85:3: error: dereferencing
> type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
> key = *(uint32_t *)f->cmd.mac.addr &
> ^
>
> [2]
> diff --git a/drivers/net/ionic/ionic_rx_filter.c
> b/drivers/net/ionic/ionic_rx_filter.c
> index 00b5cee49..f75b81a27 100644
> --- a/drivers/net/ionic/ionic_rx_filter.c
> +++ b/drivers/net/ionic/ionic_rx_filter.c
> @@ -82,8 +82,8 @@ ionic_rx_filter_save(struct ionic_lif *lif, uint32_t
> flow_id,
> key = f->cmd.vlan.vlan & IONIC_RX_FILTER_HLISTS_MASK;
> break;
> case IONIC_RX_FILTER_MATCH_MAC:
> - key = *(uint32_t *)f->cmd.mac.addr &
> - IONIC_RX_FILTER_HLISTS_MASK;
> + memcpy(&key, f->cmd.mac.addr, sizeof(key));
> + key &= IONIC_RX_FILTER_HLISTS_MASK;
> break;
> case IONIC_RX_FILTER_MATCH_MAC_VLAN:
> key = f->cmd.mac_vlan.vlan & IONIC_RX_FILTER_HLISTS_MASK;
Kindest regards
Raslan Darawsheh
More information about the dev
mailing list