提交 b42726fc 编写于 作者: N Nikita Danilov 提交者: David S. Miller

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: ea4b4d7f ("net: atlantic: loopback tests via private flags")
Signed-off-by: NNikita Danilov <ndanilov@marvell.com>
Signed-off-by: NIgor Russkikh <irusskikh@marvell.com>
Signed-off-by: NDmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f08a464c
......@@ -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) &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册