Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,8 +1038,10 @@ int hw_atl_b0_hw_irq_read(struct aq_hw_s *self, u64 *mask)

#define IS_FILTER_ENABLED(_F_) ((packet_filter & (_F_)) ? 1U : 0U)

int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self,
unsigned int packet_filter)
int hw_atl_b0_hw_packet_filter_set_int(struct aq_hw_s *self,
unsigned int base_location,
unsigned int end_location,
unsigned int packet_filter)
{
struct aq_nic_cfg_s *cfg = self->aq_nic_cfg;
unsigned int i = 0U;
Expand All @@ -1065,17 +1067,33 @@ int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self,
hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST));


for (i = HW_ATL_B0_MAC_MIN; i < HW_ATL_B0_MAC_MAX; ++i)
hw_atl_rpfl2_uc_flr_en_set(self,
(cfg->is_mc_list_enabled &&
(i <= cfg->mc_list_count)) ?
1U : 0U, i);
/*
* base_location is the first multicast slot. On A1 that is
* HW_ATL_B0_MAC_MIN. On A2, slots below the base index are not ours
* and the station MAC occupies that index, so the walk must not
* disable them. mc_list_count is a count, not an absolute slot
* number.
*/
for (i = base_location; i < end_location; ++i) {
bool enable = cfg->is_mc_list_enabled &&
(i - base_location) < cfg->mc_list_count;

hw_atl_rpfl2_uc_flr_en_set(self, enable ? 1U : 0U, i);
}

return aq_hw_err_from_flags(self);
}

#undef IS_FILTER_ENABLED

static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self,
unsigned int packet_filter)
{
return hw_atl_b0_hw_packet_filter_set_int(self, HW_ATL_B0_MAC_MIN,
HW_ATL_B0_MAC_MAX,
packet_filter);
}

static int hw_atl_b0_hw_multicast_list_set(struct aq_hw_s *self,
u8 ar_mac
[AQ_HW_MULTICAST_ADDRESS_MAX]
Expand Down
6 changes: 4 additions & 2 deletions drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ int hw_atl_b0_hw_irq_enable(struct aq_hw_s *self, u64 mask);
int hw_atl_b0_hw_irq_disable(struct aq_hw_s *self, u64 mask);
int hw_atl_b0_hw_irq_read(struct aq_hw_s *self, u64 *mask);

int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self,
unsigned int packet_filter);
int hw_atl_b0_hw_packet_filter_set_int(struct aq_hw_s *self,
unsigned int base_location,
unsigned int end_location,
unsigned int packet_filter);

#endif /* HW_ATL_B0_H */
16 changes: 14 additions & 2 deletions drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,9 +759,16 @@ static int hw_atl2_hw_ring_tx_init(struct aq_hw_s *self,
static int hw_atl2_hw_packet_filter_set(struct aq_hw_s *self,
unsigned int packet_filter)
{
struct hw_atl2_priv *priv = self->priv;
u32 base_location = priv->l2_filters_base_index + 1;
u32 end_location = min_t(u32, HW_ATL2_MAC_MAX,
priv->l2_filters_base_index +
priv->l2_filter_count);

hw_atl2_hw_new_rx_filter_promisc(self, IS_FILTER_ENABLED(IFF_PROMISC));

return hw_atl_b0_hw_packet_filter_set(self, packet_filter);
return hw_atl_b0_hw_packet_filter_set_int(self, base_location,
end_location, packet_filter);
}

#undef IS_FILTER_ENABLED
Expand All @@ -777,7 +784,12 @@ static int hw_atl2_hw_multicast_list_set(struct aq_hw_s *self,
struct aq_nic_cfg_s *cfg = self->aq_nic_cfg;
int err = 0;

if (count > (HW_ATL2_MAC_MAX - HW_ATL2_MAC_MIN)) {
/*
* The firmware window is l2_filter_count slots starting at
* l2_filters_base_index. Slot base holds the station MAC, so at most
* l2_filter_count - 1 multicast addresses fit.
*/
if (count >= priv->l2_filter_count) {
err = -EBADRQC;
goto err_exit;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,11 @@ int hw_atl2_utils_get_filter_caps(struct aq_hw_s *self)
if (priv->l2_filters_base_index >= HW_ATL2_MAC_MAX)
priv->l2_filters_base_index = HW_ATL2_MAC_UC;
priv->l2_filter_count = filter_caps.l2_filter_count;
if (!priv->l2_filter_count ||
priv->l2_filters_base_index + priv->l2_filter_count >
HW_ATL2_MAC_MAX)
priv->l2_filter_count = HW_ATL2_MAC_MAX -
priv->l2_filters_base_index;
priv->etype_filter_base_index = filter_caps.ethertype_filter_base_index;
priv->etype_filter_count = filter_caps.ethertype_filter_count;
priv->etype_filter_tag_top =
Expand Down