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 <cardigli...@ntop.org>
> Reviewed-by: Shannon Nelson <snel...@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?

[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;

Reply via email to