mirror of https://gitee.com/openkylin/linux.git
net: atlantic: better loopback mode handling
Add checks to not enable multiple loopback modes simultaneously,
It was also discovered that for dma loopback to function correctly
promisc mode should be enabled on device.
Fixes: ea4b4d7fc1
("net: atlantic: loopback tests via private flags")
Signed-off-by: Nikita Danilov <ndanilov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f08a464c27
commit
b42726fcf7
|
@ -722,6 +722,11 @@ static int aq_ethtool_set_priv_flags(struct net_device *ndev, u32 flags)
|
|||
if (flags & ~AQ_PRIV_FLAGS_MASK)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (hweight32((flags | priv_flags) & AQ_HW_LOOPBACK_MASK) > 1) {
|
||||
netdev_info(ndev, "Can't enable more than one loopback simultaneously\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cfg->priv_flags = flags;
|
||||
|
||||
if ((priv_flags ^ flags) & BIT(AQ_HW_LOOPBACK_DMA_NET)) {
|
||||
|
|
|
@ -885,13 +885,16 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self,
|
|||
{
|
||||
struct aq_nic_cfg_s *cfg = self->aq_nic_cfg;
|
||||
unsigned int i = 0U;
|
||||
u32 vlan_promisc;
|
||||
u32 l2_promisc;
|
||||
|
||||
hw_atl_rpfl2promiscuous_mode_en_set(self,
|
||||
IS_FILTER_ENABLED(IFF_PROMISC));
|
||||
l2_promisc = IS_FILTER_ENABLED(IFF_PROMISC) ||
|
||||
!!(cfg->priv_flags & BIT(AQ_HW_LOOPBACK_DMA_NET));
|
||||
vlan_promisc = l2_promisc || cfg->is_vlan_force_promisc;
|
||||
|
||||
hw_atl_rpf_vlan_prom_mode_en_set(self,
|
||||
IS_FILTER_ENABLED(IFF_PROMISC) ||
|
||||
cfg->is_vlan_force_promisc);
|
||||
hw_atl_rpfl2promiscuous_mode_en_set(self, l2_promisc);
|
||||
|
||||
hw_atl_rpf_vlan_prom_mode_en_set(self, vlan_promisc);
|
||||
|
||||
hw_atl_rpfl2multicast_flr_en_set(self,
|
||||
IS_FILTER_ENABLED(IFF_ALLMULTI) &&
|
||||
|
|
Loading…
Reference in New Issue