net: Remove usage of net_device last_rx member
authorTobias Klauser <tklauser@distanz.ch>
Wed, 18 Jan 2017 16:45:01 +0000 (17:45 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Jan 2017 22:22:49 +0000 (17:22 -0500)
The network stack no longer uses the last_rx member of struct net_device
since the bonding driver switched to use its own private last_rx in
commit 9f242738376d ("bonding: use last_arp_rx in slave_last_rx()").

However, some drivers still (ab)use the field for their own purposes and
some driver just update it without actually using it.

Previously, there was an accompanying comment for the last_rx member
added in commit 4dc89133f49b ("net: add a comment on netdev->last_rx")
which asked drivers not to update is, unless really needed. However,
this commend was removed in commit f8ff080dacec ("bonding: remove
useless updating of slave->dev->last_rx"), so some drivers added later
on still did update last_rx.

Remove all usage of last_rx and switch three drivers (sky2, atp and
smc91c92_cs) which actually read and write it to use their own private
copy in netdev_priv.

Compile-tested with allyesconfig and allmodconfig on x86 and arm.

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jay Vosburgh <j.vosburgh@gmail.com>
Cc: Veaceslav Falico <vfalico@gmail.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Cc: Mirko Lindner <mlindner@marvell.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
24 files changed:
arch/m68k/emu/nfeth.c
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
drivers/net/ethernet/hisilicon/hns/hns_enet.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/igb/igb_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/marvell/sky2.c
drivers/net/ethernet/marvell/sky2.h
drivers/net/ethernet/qualcomm/emac/emac-mac.c
drivers/net/ethernet/realtek/atp.c
drivers/net/ethernet/smsc/smc91c92_cs.c
drivers/net/irda/bfin_sir.c
drivers/net/irda/sh_sir.c
drivers/staging/ks7010/ks_hostif.c
drivers/staging/netlogic/xlr_net.c
drivers/staging/rtl8192e/rtllib_rx.c
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
drivers/staging/wlan-ng/hfa384x_usb.c
drivers/staging/wlan-ng/p80211netdev.c
include/linux/netdevice.h
net/batman-adv/bridge_loop_avoidance.c
net/batman-adv/distributed-arp-table.c
net/batman-adv/soft-interface.c

index fc4be028c4189ee9ec93265b844633411a945eb4..e45ce4243aaa3bdb7f4f22a0ecafd9de57b60261 100644 (file)
@@ -124,7 +124,6 @@ static inline void recv_packet(struct net_device *dev)
 
        skb->protocol = eth_type_trans(skb, dev);
        netif_rx(skb);
-       dev->last_rx = jiffies;
        dev->stats.rx_packets++;
        dev->stats.rx_bytes += pktlen;
 
index 2b89ec291b8bd6f1f4ae67a7f31c5b8577a99275..5ee3f007c613b1c1c9de541fc0b30b2e81f3930a 100644 (file)
@@ -2360,7 +2360,6 @@ liquidio_push_packet(u32 octeon_id __attribute__((unused)),
                if (packet_was_received) {
                        droq->stats.rx_bytes_received += len;
                        droq->stats.rx_pkts_received++;
-                       netdev->last_rx = jiffies;
                } else {
                        droq->stats.rx_dropped++;
                        netif_info(lio, rx_err, lio->netdev,
index 19d88fb387cec7663659484f6cec7d4c0bd68ed7..e96cf6cdecfd2bd5f733284e1d1b4f71b5d34353 100644 (file)
@@ -1571,7 +1571,6 @@ liquidio_push_packet(u32 octeon_id __attribute__((unused)),
                if (packet_was_received) {
                        droq->stats.rx_bytes_received += len;
                        droq->stats.rx_pkts_received++;
-                       netdev->last_rx = jiffies;
                } else {
                        droq->stats.rx_dropped++;
                        netif_info(lio, rx_err, lio->netdev,
index b7cb61385ad8412ac5f14c548ab99279f8387e83..f7b75e96c1c3b76d4e9478a3da1087a66369cbf4 100644 (file)
@@ -797,7 +797,6 @@ static void hns_nic_rx_up_pro(struct hns_nic_ring_data *ring_data,
 
        skb->protocol = eth_type_trans(skb, ndev);
        (void)napi_gro_receive(&ring_data->napi, skb);
-       ndev->last_rx = jiffies;
 }
 
 static int hns_desc_unused(struct hnae_ring *ring)
index 79651eb608ffddd7db141b94f55f303bbec7b1e7..2175cced402f7fe84dd260eecc5f3f0ab712132a 100644 (file)
@@ -240,9 +240,9 @@ static void e1000e_dump(struct e1000_adapter *adapter)
        /* Print netdevice Info */
        if (netdev) {
                dev_info(&adapter->pdev->dev, "Net device Info\n");
-               pr_info("Device Name     state            trans_start      last_rx\n");
-               pr_info("%-15s %016lX %016lX %016lX\n", netdev->name,
-                       netdev->state, dev_trans_start(netdev), netdev->last_rx);
+               pr_info("Device Name     state            trans_start\n");
+               pr_info("%-15s %016lX %016lX\n", netdev->name,
+                       netdev->state, dev_trans_start(netdev));
        }
 
        /* Print Registers */
index 7fc95493b692763a4d57194fbfeabd4801bf13d5..be456bae816906e24338006a8b3597b539f86959 100644 (file)
@@ -383,9 +383,9 @@ static void igb_dump(struct igb_adapter *adapter)
        /* Print netdevice Info */
        if (netdev) {
                dev_info(&adapter->pdev->dev, "Net device Info\n");
-               pr_info("Device Name     state            trans_start      last_rx\n");
-               pr_info("%-15s %016lX %016lX %016lX\n", netdev->name,
-                       netdev->state, dev_trans_start(netdev), netdev->last_rx);
+               pr_info("Device Name     state            trans_start\n");
+               pr_info("%-15s %016lX %016lX\n", netdev->name,
+                       netdev->state, dev_trans_start(netdev));
        }
 
        /* Print Registers */
index ffe7d940d9ffe876b16c211c44f6a77ac2d16802..3b3b52b62a5fefe530e7b32dcde6d04e643fd67d 100644 (file)
@@ -611,12 +611,11 @@ static void ixgbe_dump(struct ixgbe_adapter *adapter)
        if (netdev) {
                dev_info(&adapter->pdev->dev, "Net device Info\n");
                pr_info("Device Name     state            "
-                       "trans_start      last_rx\n");
-               pr_info("%-15s %016lX %016lX %016lX\n",
+                       "trans_start\n");
+               pr_info("%-15s %016lX %016lX\n",
                        netdev->name,
                        netdev->state,
-                       dev_trans_start(netdev),
-                       netdev->last_rx);
+                       dev_trans_start(netdev));
        }
 
        /* Print Registers */
index be003c5a4f5f7813dcbf9c04ecc8bbb3c95a9c81..2b2cc3f3ca1084ef7aebcb486a1eedc4985f3fa4 100644 (file)
@@ -2666,7 +2666,7 @@ static inline void sky2_rx_done(struct sky2_hw *hw, unsigned port,
        sky2->rx_stats.bytes += bytes;
        u64_stats_update_end(&sky2->rx_stats.syncp);
 
-       dev->last_rx = jiffies;
+       sky2->last_rx = jiffies;
        sky2_rx_update(netdev_priv(dev), rxqaddr[port]);
 }
 
@@ -2953,7 +2953,7 @@ static int sky2_rx_hung(struct net_device *dev)
        u8 fifo_lev = sky2_read8(hw, Q_ADDR(rxq, Q_RL));
 
        /* If idle and MAC or PCI is stuck */
-       if (sky2->check.last == dev->last_rx &&
+       if (sky2->check.last == sky2->last_rx &&
            ((mac_rp == sky2->check.mac_rp &&
              mac_lev != 0 && mac_lev >= sky2->check.mac_lev) ||
             /* Check if the PCI RX hang */
@@ -2965,7 +2965,7 @@ static int sky2_rx_hung(struct net_device *dev)
                              fifo_rp, sky2_read8(hw, Q_ADDR(rxq, Q_WP)));
                return 1;
        } else {
-               sky2->check.last = dev->last_rx;
+               sky2->check.last = sky2->last_rx;
                sky2->check.mac_rp = mac_rp;
                sky2->check.mac_lev = mac_lev;
                sky2->check.fifo_rp = fifo_rp;
index ec6dcd80152bdd46550b0aaf0865d00a01261a93..0fe1607968428db0b759dfb0c1be1c82afa1382d 100644 (file)
@@ -2247,6 +2247,7 @@ struct sky2_port {
        u16                  rx_data_size;
        u16                  rx_nfrags;
 
+       unsigned long        last_rx;
        struct {
                unsigned long last;
                u32     mac_rp;
index 0b4deb31e742fc4d48a2f91e865d7d750e0023c2..d297ed961da6e708312b8da3af7b92c5cecba7d4 100644 (file)
@@ -1213,7 +1213,6 @@ void emac_mac_rx_process(struct emac_adapter *adpt, struct emac_rx_queue *rx_q,
                emac_receive_skb(rx_q, skb, (u16)RRD_CVALN_TAG(&rrd),
                                 (bool)RRD_CVTAG(&rrd));
 
-               netdev->last_rx = jiffies;
                (*num_pkts)++;
        } while (*num_pkts < max_pkts);
 
index 570ed3bd3cbfcd0cbe1dc0ce5764823d1fc70ff6..9bcd4aefc9c507af16325c6099fdfa198998b93e 100644 (file)
@@ -170,7 +170,7 @@ struct net_local {
     spinlock_t lock;
     struct net_device *next_module;
     struct timer_list timer;   /* Media selection timer. */
-    long last_rx_time;         /* Last Rx, in jiffies, to handle Rx hang. */
+    unsigned long last_rx_time;        /* Last Rx, in jiffies, to handle Rx hang. */
     int saved_tx_size;
     unsigned int tx_unit_busy:1;
     unsigned char re_tx,       /* Number of packet retransmissions. */
@@ -668,11 +668,11 @@ static irqreturn_t atp_interrupt(int irq, void *dev_instance)
                        }
                        num_tx_since_rx++;
                } else if (num_tx_since_rx > 8 &&
-                          time_after(jiffies, dev->last_rx + HZ)) {
+                          time_after(jiffies, lp->last_rx_time + HZ)) {
                        if (net_debug > 2)
                                printk(KERN_DEBUG "%s: Missed packet? No Rx after %d Tx and "
                                           "%ld jiffies status %02x  CMR1 %02x.\n", dev->name,
-                                          num_tx_since_rx, jiffies - dev->last_rx, status,
+                                          num_tx_since_rx, jiffies - lp->last_rx_time, status,
                                           (read_nibble(ioaddr, CMR1) >> 3) & 15);
                        dev->stats.rx_missed_errors++;
                        hardware_init(dev);
@@ -789,7 +789,6 @@ static void net_rx(struct net_device *dev)
                read_block(ioaddr, pkt_len, skb_put(skb,pkt_len), dev->if_port);
                skb->protocol = eth_type_trans(skb, dev);
                netif_rx(skb);
-               dev->last_rx = jiffies;
                dev->stats.rx_packets++;
                dev->stats.rx_bytes += pkt_len;
        }
index 67154621abcf9775a605f9066bfe7ff41418b56c..97280daba27f7f8349eaaabc71e4514c33d9fcf3 100644 (file)
@@ -113,6 +113,7 @@ struct smc_private {
     struct mii_if_info         mii_if;
     int                                duplex;
     int                                rx_ovrn;
+    unsigned long              last_rx;
 };
 
 /* Special definitions for Megahertz multifunction cards */
@@ -1491,6 +1492,7 @@ static void smc_rx(struct net_device *dev)
     if (!(rx_status & RS_ERRORS)) {
        /* do stuff to make a new packet */
        struct sk_buff *skb;
+       struct smc_private *smc = netdev_priv(dev);
        
        /* Note: packet_length adds 5 or 6 extra bytes here! */
        skb = netdev_alloc_skb(dev, packet_length+2);
@@ -1509,7 +1511,7 @@ static void smc_rx(struct net_device *dev)
        skb->protocol = eth_type_trans(skb, dev);
        
        netif_rx(skb);
-       dev->last_rx = jiffies;
+       smc->last_rx = jiffies;
        dev->stats.rx_packets++;
        dev->stats.rx_bytes += packet_length;
        if (rx_status & RS_MULTICAST)
@@ -1790,7 +1792,7 @@ static void media_check(u_long arg)
     }
 
     /* Ignore collisions unless we've had no rx's recently */
-    if (time_after(jiffies, dev->last_rx + HZ)) {
+    if (time_after(jiffies, smc->last_rx + HZ)) {
        if (smc->tx_err || (smc->media_status & EPH_16COL))
            media |= EPH_16COL;
     }
index be5bb0b7f29ca5f90d622523ff97baaad9921b53..3151b580dbd64093fec8c9007b8ff1b8dc30ffcf 100644 (file)
@@ -22,7 +22,7 @@ static int max_rate = 57600;
 static int max_rate = 115200;
 #endif
 
-static void turnaround_delay(unsigned long last_jif, int mtt)
+static void turnaround_delay(int mtt)
 {
        long ticks;
 
@@ -209,7 +209,6 @@ static void bfin_sir_rx_chars(struct net_device *dev)
        UART_CLEAR_LSR(port);
        ch = UART_GET_CHAR(port);
        async_unwrap_char(dev, &self->stats, &self->rx_buff, ch);
-       dev->last_rx = jiffies;
 }
 
 static irqreturn_t bfin_sir_rx_int(int irq, void *dev_id)
@@ -510,7 +509,7 @@ static void bfin_sir_send_work(struct work_struct *work)
        int tx_cnt = 10;
 
        while (bfin_sir_is_receiving(dev) && --tx_cnt)
-               turnaround_delay(dev->last_rx, self->mtt);
+               turnaround_delay(self->mtt);
 
        bfin_sir_stop_rx(port);
 
index e3fe9a286136a92a09708727295f42ef4b1254aa..fede6864c737bd2710a842845bccc306cc6d2b7b 100644 (file)
@@ -547,7 +547,6 @@ static void sh_sir_rx(struct sh_sir_self *self)
 
                async_unwrap_char(self->ndev, &self->ndev->stats,
                                  &self->rx_buff, (u8)data);
-               self->ndev->last_rx = jiffies;
 
                if (EOFD & sh_sir_read(self, IRIF_SIR_FRM))
                        continue;
index 1fbd495e5e635a66dbaa5b86baa3cadacfa33762..c7652c35be1950a1d015d7e5372e6d2efaa8363a 100644 (file)
@@ -461,7 +461,6 @@ void hostif_data_indication(struct ks_wlan_private *priv)
                        skb->protocol = eth_type_trans(skb, skb->dev);
                        priv->nstats.rx_packets++;
                        priv->nstats.rx_bytes += rx_ind_size;
-                       skb->dev->last_rx = jiffies;
                        netif_rx(skb);
                } else {
                        priv->nstats.rx_dropped++;
@@ -494,7 +493,6 @@ void hostif_data_indication(struct ks_wlan_private *priv)
                        skb->protocol = eth_type_trans(skb, skb->dev);
                        priv->nstats.rx_packets++;
                        priv->nstats.rx_bytes += rx_ind_size;
-                       skb->dev->last_rx = jiffies;
                        netif_rx(skb);
                } else {
                        priv->nstats.rx_dropped++;
index f84069ffa8c6dc4af5b51bb388f994357850d6ca..781ef623233e769eb70a649a33049a2c00cb86cc 100644 (file)
@@ -155,7 +155,6 @@ static void xlr_net_fmn_handler(int bkt, int src_stnid, int size, int code,
                skb_reserve(skb, BYTE_OFFSET);
                skb_put(skb, length);
                skb->protocol = eth_type_trans(skb, skb->dev);
-               skb->dev->last_rx = jiffies;
                netif_rx(skb);
                /* Fill rx ring */
                skb_data = xlr_alloc_skb();
index e5ba7d1a809fdb30922bb1649e58eb4f426bf45f..43a77745e6fbe51a170da4f7cc921a9d44ea9f07 100644 (file)
@@ -1375,7 +1375,6 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
                ieee->LinkDetectInfo.NumRecvDataInPeriod++;
                ieee->LinkDetectInfo.NumRxOkInPeriod++;
        }
-       dev->last_rx = jiffies;
 
        /* Data frame - extract src/dst addresses */
        rtllib_rx_extract_addr(ieee, hdr, dst, src, bssid);
index 82f654305414cb9ede533b5459842a0ee7e8a5a7..b1f2fdfcb718560865874e8bbdb0d948df5b474a 100644 (file)
@@ -1103,11 +1103,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
                stats = hostap_get_stats(dev);
                from_assoc_ap = 1;
        }
-#endif
-
-       dev->last_rx = jiffies;
 
-#ifdef NOT_YET
        if ((ieee->iw_mode == IW_MODE_MASTER ||
             ieee->iw_mode == IW_MODE_REPEAT) &&
            !from_assoc_ap) {
index 4fe037aeef12975e56919e0cc01e4e472f4fe415..6134eba5cad4693997faf8d2d77947ff7e8b0713 100644 (file)
@@ -3409,7 +3409,6 @@ static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb)
                        &usbin->rxfrm.desc.frame_control, hdrlen);
 
                skb->dev = wlandev->netdev;
-               skb->dev->last_rx = jiffies;
 
                /* And set the frame length properly */
                skb_trim(skb, data_len + hdrlen);
index 73fcf07254fefd8c25d37295bf3d2375d9c978af..53dbbd69e552582f84257742bc825e0078311191 100644 (file)
@@ -252,7 +252,6 @@ static int p80211_convert_to_ether(struct wlandevice *wlandev,
        }
 
        if (skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0) {
-               skb->dev->last_rx = jiffies;
                wlandev->netdev->stats.rx_packets++;
                wlandev->netdev->stats.rx_bytes += skb->len;
                netif_rx_ni(skb);
@@ -287,7 +286,6 @@ static void p80211netdev_rx_bh(unsigned long arg)
                                skb->ip_summed = CHECKSUM_NONE;
                                skb->pkt_type = PACKET_OTHERHOST;
                                skb->protocol = htons(ETH_P_80211_RAW);
-                               dev->last_rx = jiffies;
 
                                dev->stats.rx_packets++;
                                dev->stats.rx_bytes += skb->len;
index 97ae0ac513eeec64da23b1df65f17e13a1e1ab1d..3868c32d98af8d7986a1430d4c318a0f381d35d8 100644 (file)
@@ -1551,7 +1551,6 @@ enum netdev_priv_flags {
  *     @ax25_ptr:      AX.25 specific data
  *     @ieee80211_ptr: IEEE 802.11 specific data, assign before registering
  *
- *     @last_rx:       Time of last Rx
  *     @dev_addr:      Hw address (before bcast,
  *                     because most packets are unicast)
  *
@@ -1777,8 +1776,6 @@ struct net_device {
 /*
  * Cache lines mostly used on receive path (including eth_type_trans())
  */
-       unsigned long           last_rx;
-
        /* Interface address info used in eth_type_trans() */
        unsigned char           *dev_addr;
 
index e7f690b571ea9be8ace25843d6e187a907486b99..36917a7b1b596608688f24e45733932033b0485f 100644 (file)
@@ -449,7 +449,6 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac,
        batadv_inc_counter(bat_priv, BATADV_CNT_RX);
        batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES,
                           skb->len + ETH_HLEN);
-       soft_iface->last_rx = jiffies;
 
        netif_rx(skb);
 out:
index 49576c5a3fe306a42c28c3901d2b2c6cce7d0b8e..6394206bfcae6f0cfbcd9425b28dc3ed21418bb8 100644 (file)
@@ -1050,7 +1050,6 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
                                                   bat_priv->soft_iface);
                bat_priv->stats.rx_packets++;
                bat_priv->stats.rx_bytes += skb->len + ETH_HLEN + hdr_size;
-               bat_priv->soft_iface->last_rx = jiffies;
 
                netif_rx(skb_new);
                batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n");
index 7b3494ae6ad93fd0d32391e5c88f5d636f43acd5..420e19b501f2e8c0553a62d5eeff8a6316f877d4 100644 (file)
@@ -481,8 +481,6 @@ void batadv_interface_rx(struct net_device *soft_iface,
        batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES,
                           skb->len + ETH_HLEN);
 
-       soft_iface->last_rx = jiffies;
-
        /* Let the bridge loop avoidance check the packet. If will
         * not handle it, we can safely push it up.
         */