Skip to contentSkip to conversation

sbni: update last_rx after netif_rx

PATCH In review Arnaldo Carvalho de Melo 2 participants 2 messages Feb 27, 2001 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sbni: update last_rx after netif_rx

Hi,

Please consider applying.

- Arnaldo

drivers/net/wan/sbni.c +14 -11
@@ -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;
 }
#1 lore raw

hi!

Because there is no stable linux-2.4 version of sbni driver at the moment (2.2 driver that comes with 2.4 kernel doesn't working) i dont think there is a need in this patch for current kernels. But I'll surely made these changes in 2.4 driver before releasing.
Thanks for ideas.

.
Better the devil you know than the devil you don't
Granch ltd. Security Analyst