OpenBCM V1.08-5-g2f4a (Linux)

Packet Radio Mailbox

IZ3LSV

[San Dona' di P. JN]

 Login: GUEST





  
VK7AX  > LINHAM   09.05.08 00:16l 111 Lines 3813 Bytes #999 (0) @ WW
BID : VK7AX-0905LF
Read: GUEST
Subj: PATCH] baycom_epp: use netstats in net_device structure
Path: IZ3LSV<IQ0LT<IK2XDE<IR2UBX<IV3SCP<SR1BSZ<SP7MGD<VK7AX
Sent: 080508/2308Z @:VK7AX.#ULV.TAS.AUS.OC #:45000 [Ulverstone] FBB7.00g $:VK7A
From: VK7AX@VK7AX.#ULV.TAS.AUS.OC
To  : LINHAM@WW


From: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Date: Thu, 08 May 2008 00:42:35 +0300
To: unlisted-recipients: ;(no To-header on input)
CC: linux-hams@vger.kernel.org
Newsgroups: gmane.linux.network


Use net_device_stats from net_device structure instead of local.
Kill baycom_get_stats function, because by default it is used
identical internal_stats function from net/core/dev.c

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>



diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index dde9c7e..91be84c 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -203,7 +203,6 @@ struct baycom_state {
 		unsigned char buf[TXBUFFER_SIZE];
         } hdlctx;
 
-        struct net_device_stats stats;
 	unsigned int ptt_keyed;
 	struct sk_buff *skb;  /* next transmit packet  */
 
@@ -423,7 +422,7 @@ static void encode_hdlc(struct baycom_state *bc)
 	bc->hdlctx.bufptr = bc->hdlctx.buf;
 	bc->hdlctx.bufcnt = wp - bc->hdlctx.buf;
 	dev_kfree_skb(skb);
-	bc->stats.tx_packets++;
+	bc->dev->stats.tx_packets++;
 }
 
 /* ---------------------------------------------------------------------- */
@@ -547,7 +546,7 @@ static void do_rxpacket(struct net_device *dev)
 	pktlen = bc->hdlcrx.bufcnt-2+1; /* KISS kludge */
 	if (!(skb = dev_alloc_skb(pktlen))) {
 		printk("%s: memory squeeze, dropping packet\n", dev->name);
-		bc->stats.rx_dropped++;
+		dev->stats.rx_dropped++;
 		return;
 	}
 	cp = skb_put(skb, pktlen);
@@ -556,7 +555,7 @@ static void do_rxpacket(struct net_device *dev)
 	skb->protocol = ax25_type_trans(skb, dev);
 	netif_rx(skb);
 	dev->last_rx = jiffies;
-	bc->stats.rx_packets++;
+	dev->stats.rx_packets++;
 }
 
 static int receive(struct net_device *dev, int cnt)
@@ -803,19 +802,6 @@ static int baycom_set_mac_address(struct net_device *dev, void *addr)
 
 /* --------------------------------------------------------------------- */
 
-static struct net_device_stats *baycom_get_stats(struct net_device *dev)
-{
-	struct baycom_state *bc = netdev_priv(dev);
-
-	/* 
-	 * Get the current statistics.  This may be called with the
-	 * card open or closed. 
-	 */
-	return &bc->stats;
-}
-
-/* --------------------------------------------------------------------- */
-
 static void epp_wakeup(void *handle)
 {
         struct net_device *dev = (struct net_device *)handle;
@@ -1066,10 +1052,10 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 		hi.data.cs.ptt = !!(bc->stat & EPP_PTTBIT);
 		hi.data.cs.dcd = !(bc->stat & EPP_DCDBIT);
 		hi.data.cs.ptt_keyed = bc->ptt_keyed;
-		hi.data.cs.tx_packets = bc->stats.tx_packets;
-		hi.data.cs.tx_errors = bc->stats.tx_errors;
-		hi.data.cs.rx_packets = bc->stats.rx_packets;
-		hi.data.cs.rx_errors = bc->stats.rx_errors;
+		hi.data.cs.tx_packets = dev->stats.tx_packets;
+		hi.data.cs.tx_errors = dev->stats.tx_errors;
+		hi.data.cs.rx_packets = dev->stats.rx_packets;
+		hi.data.cs.rx_errors = dev->stats.rx_errors;
 		break;		
 
 	case HDLCDRVCTL_OLDGETSTAT:
@@ -1148,7 +1134,6 @@ static void baycom_probe(struct net_device *dev)
 	dev->stop = epp_close;
 	dev->do_ioctl = baycom_ioctl;
 	dev->hard_start_xmit = baycom_send_packet;
-	dev->get_stats = baycom_get_stats;
 
 	/* Fill in the fields of the device structure */
 	bc->skb = NULL;

---------------------------------------------------------------------------

**************************************************************************
 ABOVE IS A CROSS POST TO THE PACKET RADIO NETWORK IN AN ATTEMPT TO PROMOTE
 FURTHER INTEREST IN HAM SOFTWARE USING LINUX OPERATING SYSTEMS & PACKET RADIO
 Courtesy Tony VK7AX  VK7AX@VK7AX.#ULV.TAS.AUS.OC 

**************************************************************************


Read previous mail | Read next mail


 19.01.2025 07:22:38lGo back Go up