[PATCH] sbni: update last_rx after netif_rx

From: Arnaldo Carvalho de Melo (acme@conectiva.com.br)
Date: Mon Feb 26 2001 - 20:49:11 EST


Hi,

        Please consider applying.

- Arnaldo

--- linux-2.4.2/drivers/net/wan/sbni.c Tue Feb 13 19:15:05 2001
+++ linux-2.4.2.acme/drivers/net/wan/sbni.c Tue Feb 27 00:19:32 2001
@@ -460,7 +460,7 @@
          * generate Ethernet address (0x00ff01xxxxxx)
          */
 
- *(u16*)dev->dev_addr = htons(0x00ff);
+ *(u16*)dev->dev_addr = __constant_htons(0x00ff);
         *(u32*)(dev->dev_addr+2) = htonl(((def_mac ? def_mac : (u32) dev->priv) & 0x00ffffff) | 0x01000000);
    
         lp = dev->priv;
@@ -962,12 +962,17 @@
 static inline void sbni_get_packet(struct net_device* dev)
 {
         struct net_local* lp = (struct net_local*)dev->priv;
+ int pktlen = lp->inppos - ETH_HLEN + sizeof(struct sbni_hard_header);
+ struct net_device* rx_dev =
+#ifdef KATYUSHA
+ lp->m;
+#else
+ dev;
+#endif
         struct sk_buff* skb;
         unsigned char *rawp;
     
-
-
- skb = dev_alloc_skb(lp->inppos - ETH_HLEN + sizeof(struct sbni_hard_header));
+ skb = dev_alloc_skb(pktlen);
    
         if(skb == NULL)
         {
@@ -975,11 +980,7 @@
                 lp->stats.rx_dropped++;
                 return;
         } else {
-#ifdef KATYUSHA
- skb->dev = lp->m;
-#else
- skb->dev = dev;
-#endif
+ skb->dev = rx_dev;
                 memcpy((unsigned char*)skb_put(skb, lp->inppos + 8)+8,
                         lp->eth_rcv_buffer,
                         lp->inppos);
@@ -1006,9 +1007,9 @@
                 {
                         rawp = (unsigned char*)(&lp->eth_rcv_buffer[2*ETH_ALEN]);
                         if (*(unsigned short *)rawp == 0xFFFF)
- skb->protocol=htons(ETH_P_802_3);
+ skb->protocol=__constant_htons(ETH_P_802_3);
                         else
- skb->protocol=htons(ETH_P_802_2);
+ skb->protocol=__constant_htons(ETH_P_802_2);
                 }
             
 
@@ -1016,6 +1017,8 @@
    
                 netif_rx(skb);
                 lp->stats.rx_packets++;
+ lp->stats.rx_bytes += pktlen;
+ rx_dev->last_rx = jiffies;
         }
         return;
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Feb 28 2001 - 21:00:13 EST