Make reception of FCS on AX88179A configuration-dependent.
In contrast to what the name suggests, AX_RX_CTL_DROPCRCERR
actually instructs the MAC to leave the FCS attached to the end of the
Ethernet frame when sent by the USB-adapter to the host. This was
tested for AX88179A as well as on the AX88772D, which behaves the same
as the AX88179A in respect of this flag, as this refers to MAC
functionality and the AX88772D is merely a AX88179A with a different
integrated 100Mbit PHY.
For the older AX88179, the behaviour does not change.
For AX88279-based adapters, the flag must be set in order to receive
complete frames, however, the FCS is not necessarily usable, as it
is only part of the transferred up-to 8-byte padding area, and for
some frame-lengths only 2 of the 4 bytes of the FCS are transferred
to the host.
The AX_RX_CTL_DROPCRCERR flag has no influence on dropping of corrupt
frames already by the USB adapter.
Fixes: 7d573278f9a5 ("ax88179_178a: Add HW support for AX179A-based chips")
Signed-off-by: Birger Koblitz <ma…@birger-koblitz.de>
---
drivers/net/usb/ax88179_lib.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/net/usb/ax88179_lib.c b/drivers/net/usb/ax88179_lib.c
index 821ee9cd8ded1b8f1e425bcef493fb175ed30376..353b3a74793084085c42c1068caf5922e0681ad3 100644
--- a/drivers/net/usb/ax88179_lib.c
+++ b/drivers/net/usb/ax88179_lib.c
@@ -352,14 +352,22 @@ void ax88179_set_multicast(struct net_device *net)
struct usbnet *dev = netdev_priv(net);
u8 *m_filter = ((u8 *)dev->data);
struct ax88179_data *data;
- u16 rxctl = 0;
+ u16 rxctl;
data = dev->driver_priv;
- rxctl = (AX_RX_CTL_START | AX_RX_CTL_AB | AX_RX_CTL_DROPCRCERR);
+ if (data->chip_version >= AX_VERSION_AX88179A) {
+ rxctl = READ_ONCE(data->rxctl);
+ rxctl &= ~(AX_RX_CTL_IPE | AX_RX_CTL_DROPCRCERR | AX_RX_CTL_PRO |
+ AX_RX_CTL_AMALL | AX_RX_CTL_AM);
+ } else {
+ rxctl = (AX_RX_CTL_START | AX_RX_CTL_AB | AX_RX_CTL_DROPCRCERR);
+ }
if (data->ip_align)
rxctl |= AX_RX_CTL_IPE;
-
+ if (net->features & (NETIF_F_RXFCS | NETIF_F_RXALL) ||
+ data->chip_version != AX_VERSION_AX88179A)
+ rxctl |= AX_RX_CTL_DROPCRCERR;
if (net->flags & IFF_PROMISC) {
rxctl |= AX_RX_CTL_PRO;
} else if (net->flags & IFF_ALLMULTI ||
--
2.47.3