summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-01-21 05:27:32 +0000
committerShaun Ruffell <sruffell@digium.com>2011-01-21 05:27:32 +0000
commitce5a14b14b3960a0954c7356bf09ec05dc1db510 (patch)
tree41a08e8b5a5b2aaeae6204b36fd069d7998b24a3
parentd1bb25c741db6b4bc8b560808c97bdb1b33ec588 (diff)
dahdi: Fix compilation error when CONFIG_DAHDI_NET is defined.
Kernel interface for network devices changed. This is the patch from issue plus a few trivial checkpatch.pl formatting changes (minus the >80 column warnings). (closes issue #17857) Reported by: msink Patches: dahdi_net-v2.patch uploaded by msink (license 1103) Signed-off-by: Shaun Ruffell <sruffell@digium.com> Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=9247 git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/branches/2.4@9655 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/dahdi-base.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index 8945841..e443dda 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -1665,6 +1665,13 @@ static inline void print_debug_writebuf(struct dahdi_chan* ss, struct sk_buff *s
#endif
#ifdef CONFIG_DAHDI_NET
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
+static inline struct net_device_stats *hdlc_stats(struct net_device *dev)
+{
+ return &dev->stats;
+}
+#endif
+
#ifdef NEW_HDLC_INTERFACE
static int dahdi_net_open(struct net_device *dev)
{
@@ -4134,6 +4141,15 @@ static void recalc_slaves(struct dahdi_chan *chan)
#endif
}
+#if defined(CONFIG_DAHDI_NET) && defined(HAVE_NET_DEVICE_OPS)
+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 */
@@ -4382,9 +4398,13 @@ static int dahdi_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long da
#endif
chans[ch.chan]->hdlcnetdev->netdev->irq = chans[ch.chan]->span->irq;
chans[ch.chan]->hdlcnetdev->netdev->tx_queue_len = 50;
+#ifdef HAVE_NET_DEVICE_OPS
+ chans[ch.chan]->hdlcnetdev->netdev->netdev_ops = &dahdi_netdev_ops;
+#else
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;
+#endif
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);
@@ -7636,8 +7656,11 @@ static inline void __putbuf_chunk(struct dahdi_chan *ss, unsigned char *rxb, int
#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]);