net: ipa: open-code ether_setup()
authorAlex Elder <elder@linaro.org>
Thu, 19 May 2022 15:12:14 +0000 (10:12 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 May 2022 10:12:24 +0000 (11:12 +0100)
About half of the fields set by the call in ipa_modem_netdev_setup()
are overwritten after the call.  Instead, just skip the call, and
open-code the (other) assignments it makes to the net_device
structure fields.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ipa/ipa_modem.c

index 27d87097433f005c4a39f540d5a3b34f02aa496b..dd6464ced2546d619f2807c92ec065702bb78755 100644 (file)
@@ -9,6 +9,8 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <linux/if_rmnet.h>
+#include <linux/etherdevice.h>
+#include <net/pkt_sched.h>
 #include <linux/pm_runtime.h>
 #include <linux/remoteproc/qcom_rproc.h>
 
@@ -203,15 +205,20 @@ static const struct net_device_ops ipa_modem_ops = {
 static void ipa_modem_netdev_setup(struct net_device *netdev)
 {
        netdev->netdev_ops = &ipa_modem_ops;
-       ether_setup(netdev);
-       /* No header ops (override value set by ether_setup()) */
+
        netdev->header_ops = NULL;
        netdev->type = ARPHRD_RAWIP;
        netdev->hard_header_len = 0;
+       netdev->min_header_len = ETH_HLEN;
+       netdev->min_mtu = ETH_MIN_MTU;
        netdev->max_mtu = IPA_MTU;
        netdev->mtu = netdev->max_mtu;
        netdev->addr_len = 0;
+       netdev->tx_queue_len = DEFAULT_TX_QUEUE_LEN;
        netdev->flags &= ~(IFF_BROADCAST | IFF_MULTICAST);
+       netdev->priv_flags |= IFF_TX_SKB_SHARING;
+       eth_broadcast_addr(netdev->broadcast);
+
        /* The endpoint is configured for QMAP */
        netdev->needed_headroom = sizeof(struct rmnet_map_header);
        netdev->needed_tailroom = IPA_NETDEV_TAILROOM;