net: selftests: add MTU test
authorOleksij Rempel <o.rempel@pengutronix.de>
Thu, 22 Jul 2021 07:34:27 +0000 (09:34 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Jul 2021 07:52:04 +0000 (00:52 -0700)
Test if we actually can send/receive packets with MTU size. This kind of
issue was detected on ASIX HW with bogus EEPROM.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/selftests.c

index ba7b017..9077fa9 100644 (file)
@@ -318,6 +318,15 @@ static int net_test_phy_loopback_udp(struct net_device *ndev)
        return __net_test_loopback(ndev, &attr);
 }
 
+static int net_test_phy_loopback_udp_mtu(struct net_device *ndev)
+{
+       struct net_packet_attrs attr = { };
+
+       attr.dst = ndev->dev_addr;
+       attr.max_size = ndev->mtu;
+       return __net_test_loopback(ndev, &attr);
+}
+
 static int net_test_phy_loopback_tcp(struct net_device *ndev)
 {
        struct net_packet_attrs attr = { };
@@ -344,6 +353,9 @@ static const struct net_test {
        }, {
                .name = "PHY internal loopback, UDP    ",
                .fn = net_test_phy_loopback_udp,
+       }, {
+               .name = "PHY internal loopback, MTU    ",
+               .fn = net_test_phy_loopback_udp_mtu,
        }, {
                .name = "PHY internal loopback, TCP    ",
                .fn = net_test_phy_loopback_tcp,