Add the use of the new Shared MAC filter bit for multicast
and broadcast filters in order to make better use of the
filters available from the device. The FW folks have assured
that setting this bit on older FW will have no affect, so it
doesn't need a version check.

Signed-off-by: Helin Zhang <helin.zhang at intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 1 +
 drivers/net/i40e/base/i40e_common.c     | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index aa11bcd..cd55a36 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -1033,6 +1033,7 @@ struct i40e_aqc_add_macvlan_element_data {
 #define I40E_AQC_MACVLAN_ADD_HASH_MATCH                0x0002
 #define I40E_AQC_MACVLAN_ADD_IGNORE_VLAN       0x0004
 #define I40E_AQC_MACVLAN_ADD_TO_QUEUE          0x0008
+#define I40E_AQC_MACVLAN_ADD_USE_SHARED_MAC    0x0010
        __le16  queue_number;
 #define I40E_AQC_MACVLAN_CMD_QUEUE_SHIFT       0
 #define I40E_AQC_MACVLAN_CMD_QUEUE_MASK                (0x7FF << \
diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index cc8a63e..44855b3 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2777,6 +2777,7 @@ enum i40e_status_code i40e_aq_add_macvlan(struct i40e_hw 
*hw, u16 seid,
                (struct i40e_aqc_macvlan *)&desc.params.raw;
        enum i40e_status_code status;
        u16 buf_size;
+       int i;

        if (count == 0 || !mv_list || !hw)
                return I40E_ERR_PARAM;
@@ -2790,12 +2791,17 @@ enum i40e_status_code i40e_aq_add_macvlan(struct 
i40e_hw *hw, u16 seid,
        cmd->seid[1] = 0;
        cmd->seid[2] = 0;

+       for (i = 0; i < count; i++)
+               if (I40E_IS_MULTICAST(mv_list[i].mac_addr))
+                       mv_list[i].flags |=
+                           CPU_TO_LE16(I40E_AQC_MACVLAN_ADD_USE_SHARED_MAC);
+
        desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
        if (buf_size > I40E_AQ_LARGE_BUF)
                desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB);

        status = i40e_asq_send_command(hw, &desc, mv_list, buf_size,
-                                   cmd_details);
+                                      cmd_details);

        return status;
 }
-- 
2.5.0

Reply via email to