net/sfc: support multicast addresses list controls
authorIvan Malov <ivan.malov@oktetlabs.ru>
Thu, 15 Dec 2016 12:51:03 +0000 (12:51 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 17 Jan 2017 18:40:50 +0000 (19:40 +0100)
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
Reviewed-by: Robert Stonehouse <rstonehouse@solarflare.com>
doc/guides/nics/features/sfc_efx.ini
doc/guides/nics/sfc_efx.rst
drivers/net/sfc/sfc_ethdev.c

index aaea993..35633cb 100644 (file)
@@ -11,6 +11,7 @@ MTU update           = Y
 Jumbo frame          = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
+Multicast MAC filter = Y
 Flow control         = Y
 L3 checksum offload  = P
 L4 checksum offload  = P
index 984da9c..43dd4cf 100644 (file)
@@ -63,6 +63,8 @@ SFC EFX PMD has support for:
 
 - Allmulticast mode
 
+- Multicast MAC filter
+
 
 Non-supported Features
 ----------------------
index eee9072..4766ae9 100644 (file)
@@ -758,6 +758,45 @@ unlock:
 }
 
 
+static int
+sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set,
+                    uint32_t nb_mc_addr)
+{
+       struct sfc_adapter *sa = dev->data->dev_private;
+       uint8_t *mc_addrs_p;
+       uint8_t *mc_addrs;
+       int rc;
+       unsigned int i;
+
+       if (nb_mc_addr > EFX_MAC_MULTICAST_LIST_MAX) {
+               sfc_err(sa, "too many multicast addresses: %u > %u",
+                        nb_mc_addr, EFX_MAC_MULTICAST_LIST_MAX);
+               return -EINVAL;
+       }
+
+       mc_addrs_p = rte_calloc("mc-addrs", nb_mc_addr, EFX_MAC_ADDR_LEN, 0);
+       if (mc_addrs_p == NULL)
+               return -ENOMEM;
+
+       mc_addrs = mc_addrs_p;
+
+       for (i = 0; i < nb_mc_addr; ++i) {
+               (void)rte_memcpy(mc_addrs, mc_addr_set[i].addr_bytes,
+                                EFX_MAC_ADDR_LEN);
+               mc_addrs += EFX_MAC_ADDR_LEN;
+       }
+
+       rc = efx_mac_multicast_list_set(sa->nic, mc_addrs_p, nb_mc_addr);
+
+       rte_free(mc_addrs_p);
+
+       if (rc != 0)
+               sfc_err(sa, "cannot set multicast address list (rc = %u)", rc);
+
+       SFC_ASSERT(rc > 0);
+       return -rc;
+}
+
 static const struct eth_dev_ops sfc_eth_dev_ops = {
        .dev_configure                  = sfc_dev_configure,
        .dev_start                      = sfc_dev_start,
@@ -782,6 +821,7 @@ static const struct eth_dev_ops sfc_eth_dev_ops = {
        .flow_ctrl_get                  = sfc_flow_ctrl_get,
        .flow_ctrl_set                  = sfc_flow_ctrl_set,
        .mac_addr_set                   = sfc_mac_addr_set,
+       .set_mc_addr_list               = sfc_set_mc_addr_list,
 };
 
 static int