[asterisk-bugs] [DAHDI-linux 0017857]: [patch] CONFIG_DAHDI_NET compiling error

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Aug 13 08:04:31 CDT 2010


The following issue has been SUBMITTED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17857 
====================================================================== 
Reported By:                msink
Assigned To:                
====================================================================== 
Project:                    DAHDI-linux
Issue ID:                   17857
Category:                   dahdi (the module)
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
JIRA:                        
Reviewboard Link:            
====================================================================== 
Date Submitted:             2010-08-13 08:04 CDT
Last Modified:              2010-08-13 08:04 CDT
====================================================================== 
Summary:                    [patch] CONFIG_DAHDI_NET compiling error
Description: 
dahdi-base.c don't compiles in latest kernel if CONFIG_DAHDI_NET enabled
With this path it compiles and works:

=======
diff -urN dahdi-linux-2.3.0.1-orig/drivers/dahdi/dahdi-base.c
dahdi-linux-2.3.0.1/drivers/dahdi/dahdi-base.c
--- dahdi-linux-2.3.0.1-orig/drivers/dahdi/dahdi-base.c	2010-04-20
01:42:53.000000000 +0600
+++ dahdi-linux-2.3.0.1/drivers/dahdi/dahdi-base.c	2010-06-02
14:07:32.000000000 +0600
@@ -1754,7 +1754,7 @@
 	/* FIXME: this construction seems to be not very optimal for me but I
could find nothing better at the moment (Friday, 10PM :( )  --byg */
 /*	struct dahdi_chan *ss = hdlc_to_ztchan(list_entry(dev, struct
dahdi_hdlc, netdev.netdev));*/
 	struct dahdi_chan *ss = dev_to_ztchan(dev);
-	struct net_device_stats *stats = hdlc_stats(dev);
+	struct net_device_stats *stats = &dev->stats;
 
 #else
 static int dahdi_xmit(hdlc_device *hdlc, struct sk_buff *skb)
@@ -4057,6 +4057,15 @@
 #endif
 }
 
+#ifdef CONFIG_DAHDI_NET
+static const struct net_device_ops dahdi_netdev_ops = {
+	.ndo_open       = dahdi_net_open,
+	.ndo_stop       = dahdi_net_stop,
+	.ndo_do_ioctl   = dahdi_net_ioctl,
+	.ndo_start_xmit = dahdi_xmit,
+};
+#endif
+
 static int dahdi_ctl_ioctl(struct file *file, unsigned int cmd, unsigned
long data)
 {
 	/* I/O CTL's for control interface */
@@ -4309,9 +4318,7 @@
 #endif
 					chans[ch.chan]->hdlcnetdev->netdev->irq =
chans[ch.chan]->span->irq;
 					chans[ch.chan]->hdlcnetdev->netdev->tx_queue_len = 50;
-					chans[ch.chan]->hdlcnetdev->netdev->do_ioctl = dahdi_net_ioctl;
-					chans[ch.chan]->hdlcnetdev->netdev->open = dahdi_net_open;
-					chans[ch.chan]->hdlcnetdev->netdev->stop = dahdi_net_stop;
+					chans[ch.chan]->hdlcnetdev->netdev->netdev_ops = &dahdi_netdev_ops;
 					dev_to_hdlc(chans[ch.chan]->hdlcnetdev->netdev)->attach =
dahdi_net_attach;
 					dev_to_hdlc(chans[ch.chan]->hdlcnetdev->netdev)->xmit = dahdi_xmit;
 					spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
@@ -7560,14 +7567,17 @@
 #ifdef CONFIG_DAHDI_PPP
 						if (!ms->do_ppp_error)
 #endif
-							skb = dev_alloc_skb(ms->readn[ms->inreadbuf]);
+							skb = dev_alloc_skb(ms->readn[ms->inreadbuf] + 2);
 						if (skb) {
+							unsigned char cisco_addr = *(ms->readbuf[ms->inreadbuf]);
+							if (cisco_addr != 0x0f && cisco_addr != 0x8f)
+								skb_reserve(skb, 2);
 							/* XXX Get rid of this memcpy XXX */
 							memcpy(skb->data, ms->readbuf[ms->inreadbuf],
ms->readn[ms->inreadbuf]);
 							skb_put(skb, ms->readn[ms->inreadbuf]);
 #ifdef CONFIG_DAHDI_NET
 							if (ms->flags & DAHDI_FLAG_NETDEV) {
-								struct net_device_stats *stats =
hdlc_stats(ms->hdlcnetdev->netdev);
+								struct net_device_stats *stats = &ms->hdlcnetdev->netdev->stats;
 								stats->rx_packets++;
 								stats->rx_bytes += ms->readn[ms->inreadbuf];
 							}
@@ -7576,7 +7586,7 @@
 						} else {
 #ifdef CONFIG_DAHDI_NET
 							if (ms->flags & DAHDI_FLAG_NETDEV) {
-								struct net_device_stats *stats =
hdlc_stats(ms->hdlcnetdev->netdev);
+								struct net_device_stats *stats = &ms->hdlcnetdev->netdev->stats;
 								stats->rx_dropped++;
 							}
 #endif
@@ -7674,7 +7684,7 @@
 
 #ifdef CONFIG_DAHDI_NET
 				if (ms->flags & DAHDI_FLAG_NETDEV) {
-					struct net_device_stats *stats =
hdlc_stats(ms->hdlcnetdev->netdev);
+					struct net_device_stats *stats = &ms->hdlcnetdev->netdev->stats;
 					stats->rx_errors++;
 					if (abort == DAHDI_EVENT_OVERRUN)
 						stats->rx_over_errors++;

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-08-13 08:04 msink          New Issue                                    
======================================================================




More information about the asterisk-bugs mailing list