Skip to content

Commit 48dd73d

Browse files
logostdavem330
authored andcommitted
net: aquantia: fix vlans not working over bridged network
In configuration of vlan over bridge over aquantia device it was found that vlan tagged traffic is dropped on chip. The reason is that bridge device enables promisc mode, but in atlantic chip vlan filters will still apply. So we have to corellate promisc settings with vlan configuration. The solution is to track in a separate state variable the need of vlan forced promisc. And also consider generic promisc configuration when doing vlan filter config. Fixes: 7975d2a ("net: aquantia: add support of rx-vlan-filter offload") Signed-off-by: Dmitry Bogdanov <[email protected]> Signed-off-by: Igor Russkikh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5b18f12 commit 48dd73d

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

drivers/net/ethernet/aquantia/atlantic/aq_filters.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,9 +843,14 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic)
843843
return err;
844844

845845
if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) {
846-
if (hweight < AQ_VLAN_MAX_FILTERS)
847-
err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, true);
846+
if (hweight < AQ_VLAN_MAX_FILTERS && hweight > 0) {
847+
err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw,
848+
!(aq_nic->packet_filter & IFF_PROMISC));
849+
aq_nic->aq_nic_cfg.is_vlan_force_promisc = false;
850+
} else {
848851
/* otherwise left in promiscue mode */
852+
aq_nic->aq_nic_cfg.is_vlan_force_promisc = true;
853+
}
849854
}
850855

851856
return err;
@@ -866,6 +871,7 @@ int aq_filters_vlan_offload_off(struct aq_nic_s *aq_nic)
866871
if (unlikely(!aq_hw_ops->hw_filter_vlan_ctrl))
867872
return -EOPNOTSUPP;
868873

874+
aq_nic->aq_nic_cfg.is_vlan_force_promisc = true;
869875
err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, false);
870876
if (err)
871877
return err;

drivers/net/ethernet/aquantia/atlantic/aq_nic.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ void aq_nic_cfg_start(struct aq_nic_s *self)
126126

127127
cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk;
128128
cfg->features = cfg->aq_hw_caps->hw_features;
129+
cfg->is_vlan_force_promisc = true;
129130
}
130131

131132
static int aq_nic_update_link_status(struct aq_nic_s *self)

drivers/net/ethernet/aquantia/atlantic/aq_nic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct aq_nic_cfg_s {
3535
u32 flow_control;
3636
u32 link_speed_msk;
3737
u32 wol;
38+
bool is_vlan_force_promisc;
3839
u16 is_mc_list_enabled;
3940
u16 mc_list_count;
4041
bool is_autoneg;

drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,15 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self,
778778
unsigned int packet_filter)
779779
{
780780
unsigned int i = 0U;
781+
struct aq_nic_cfg_s *cfg = self->aq_nic_cfg;
782+
783+
hw_atl_rpfl2promiscuous_mode_en_set(self,
784+
IS_FILTER_ENABLED(IFF_PROMISC));
785+
786+
hw_atl_rpf_vlan_prom_mode_en_set(self,
787+
IS_FILTER_ENABLED(IFF_PROMISC) ||
788+
cfg->is_vlan_force_promisc);
781789

782-
hw_atl_rpfl2promiscuous_mode_en_set(self, IS_FILTER_ENABLED(IFF_PROMISC));
783790
hw_atl_rpfl2multicast_flr_en_set(self,
784791
IS_FILTER_ENABLED(IFF_ALLMULTI), 0);
785792

@@ -788,13 +795,13 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self,
788795

789796
hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST));
790797

791-
self->aq_nic_cfg->is_mc_list_enabled = IS_FILTER_ENABLED(IFF_MULTICAST);
798+
cfg->is_mc_list_enabled = IS_FILTER_ENABLED(IFF_MULTICAST);
792799

793800
for (i = HW_ATL_B0_MAC_MIN; i < HW_ATL_B0_MAC_MAX; ++i)
794801
hw_atl_rpfl2_uc_flr_en_set(self,
795-
(self->aq_nic_cfg->is_mc_list_enabled &&
796-
(i <= self->aq_nic_cfg->mc_list_count)) ?
797-
1U : 0U, i);
802+
(cfg->is_mc_list_enabled &&
803+
(i <= cfg->mc_list_count)) ?
804+
1U : 0U, i);
798805

799806
return aq_hw_err_from_flags(self);
800807
}
@@ -1086,7 +1093,7 @@ static int hw_atl_b0_hw_vlan_set(struct aq_hw_s *self,
10861093
static int hw_atl_b0_hw_vlan_ctrl(struct aq_hw_s *self, bool enable)
10871094
{
10881095
/* set promisc in case of disabing the vland filter */
1089-
hw_atl_rpf_vlan_prom_mode_en_set(self, !!!enable);
1096+
hw_atl_rpf_vlan_prom_mode_en_set(self, !enable);
10901097

10911098
return aq_hw_err_from_flags(self);
10921099
}

0 commit comments

Comments
 (0)