aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-01-07 21:04:17 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-07 21:04:17 -0500
commitd700555bdaa34ff3e910300b4d58ea4d5523ce70 (patch)
tree9e73530fff0236373f21fe36a29fda370fa43766 /drivers/isdn
parent0e2445fbdd2bfc7055f6e9ab83842bebcaf4868f (diff)
I4l: convert to net_device_ops
Add net_device_ops and use interal stats Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Karsten Keil <kkeil@suse.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/i4l/isdn_net.c69
1 files changed, 45 insertions, 24 deletions
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 023ea11d2f9e..7c5f97033b9f 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -1485,6 +1485,24 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1485 return (rc); 1485 return (rc);
1486} 1486}
1487 1487
1488
1489static int isdn_net_ioctl(struct net_device *dev,
1490 struct ifreq *ifr, int cmd)
1491{
1492 isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev);
1493
1494 switch (lp->p_encap) {
1495#ifdef CONFIG_ISDN_PPP
1496 case ISDN_NET_ENCAP_SYNCPPP:
1497 return isdn_ppp_dev_ioctl(dev, ifr, cmd);
1498#endif
1499 case ISDN_NET_ENCAP_CISCOHDLCK:
1500 return isdn_ciscohdlck_dev_ioctl(dev, ifr, cmd);
1501 default:
1502 return -EINVAL;
1503 }
1504}
1505
1488/* called via cisco_timer.function */ 1506/* called via cisco_timer.function */
1489static void 1507static void
1490isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data) 1508isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
@@ -1998,23 +2016,6 @@ isdn_net_init(struct net_device *ndev)
1998 ushort max_hlhdr_len = 0; 2016 ushort max_hlhdr_len = 0;
1999 int drvidx; 2017 int drvidx;
2000 2018
2001 ether_setup(ndev);
2002 ndev->header_ops = NULL;
2003
2004 /* Setup the generic properties */
2005 ndev->mtu = 1500;
2006 ndev->flags = IFF_NOARP|IFF_POINTOPOINT;
2007 ndev->type = ARPHRD_ETHER;
2008 ndev->addr_len = ETH_ALEN;
2009 ndev->validate_addr = NULL;
2010
2011 /* for clients with MPPP maybe higher values better */
2012 ndev->tx_queue_len = 30;
2013
2014 /* The ISDN-specific entries in the device structure. */
2015 ndev->open = &isdn_net_open;
2016 ndev->hard_start_xmit = &isdn_net_start_xmit;
2017
2018 /* 2019 /*
2019 * up till binding we ask the protocol layer to reserve as much 2020 * up till binding we ask the protocol layer to reserve as much
2020 * as we might need for HL layer 2021 * as we might need for HL layer
@@ -2026,9 +2027,6 @@ isdn_net_init(struct net_device *ndev)
2026 max_hlhdr_len = dev->drv[drvidx]->interface->hl_hdrlen; 2027 max_hlhdr_len = dev->drv[drvidx]->interface->hl_hdrlen;
2027 2028
2028 ndev->hard_header_len = ETH_HLEN + max_hlhdr_len; 2029 ndev->hard_header_len = ETH_HLEN + max_hlhdr_len;
2029 ndev->stop = &isdn_net_close;
2030 ndev->get_stats = &isdn_net_get_stats;
2031 ndev->do_ioctl = NULL;
2032 return 0; 2030 return 0;
2033} 2031}
2034 2032
@@ -2508,6 +2506,19 @@ isdn_net_force_dial(char *name)
2508 return (isdn_net_force_dial_lp(p->local)); 2506 return (isdn_net_force_dial_lp(p->local));
2509} 2507}
2510 2508
2509/* The ISDN-specific entries in the device structure. */
2510static const struct net_device_ops isdn_netdev_ops = {
2511 .ndo_init = isdn_net_init,
2512 .ndo_open = isdn_net_open,
2513 .ndo_stop = isdn_net_close,
2514 .ndo_do_ioctl = isdn_net_ioctl,
2515
2516 .ndo_validate_addr = NULL,
2517 .ndo_start_xmit = isdn_net_start_xmit,
2518 .ndo_get_stats = isdn_net_get_stats,
2519 .ndo_tx_timeout = isdn_net_tx_timeout,
2520};
2521
2511/* 2522/*
2512 * Helper for alloc_netdev() 2523 * Helper for alloc_netdev()
2513 */ 2524 */
@@ -2515,7 +2526,20 @@ static void _isdn_setup(struct net_device *dev)
2515{ 2526{
2516 isdn_net_local *lp = netdev_priv(dev); 2527 isdn_net_local *lp = netdev_priv(dev);
2517 2528
2529 ether_setup(dev);
2530
2518 dev->flags = IFF_NOARP | IFF_POINTOPOINT; 2531 dev->flags = IFF_NOARP | IFF_POINTOPOINT;
2532 /* Setup the generic properties */
2533 dev->mtu = 1500;
2534 dev->flags = IFF_NOARP|IFF_POINTOPOINT;
2535 dev->type = ARPHRD_ETHER;
2536 dev->addr_len = ETH_ALEN;
2537 dev->header_ops = NULL;
2538 dev->netdev_ops = &isdn_netdev_ops;
2539
2540 /* for clients with MPPP maybe higher values better */
2541 dev->tx_queue_len = 30;
2542
2519 lp->p_encap = ISDN_NET_ENCAP_RAWIP; 2543 lp->p_encap = ISDN_NET_ENCAP_RAWIP;
2520 lp->magic = ISDN_NET_MAGIC; 2544 lp->magic = ISDN_NET_MAGIC;
2521 lp->last = lp; 2545 lp->last = lp;
@@ -2570,7 +2594,7 @@ isdn_net_new(char *name, struct net_device *master)
2570 return NULL; 2594 return NULL;
2571 } 2595 }
2572 netdev->local = netdev_priv(netdev->dev); 2596 netdev->local = netdev_priv(netdev->dev);
2573 netdev->dev->init = isdn_net_init; 2597
2574 if (master) { 2598 if (master) {
2575 /* Device shall be a slave */ 2599 /* Device shall be a slave */
2576 struct net_device *p = MASTER_TO_SLAVE(master); 2600 struct net_device *p = MASTER_TO_SLAVE(master);
@@ -2588,7 +2612,6 @@ isdn_net_new(char *name, struct net_device *master)
2588 /* 2612 /*
2589 * Watchdog timer (currently) for master only. 2613 * Watchdog timer (currently) for master only.
2590 */ 2614 */
2591 netdev->dev->tx_timeout = isdn_net_tx_timeout;
2592 netdev->dev->watchdog_timeo = ISDN_NET_TX_TIMEOUT; 2615 netdev->dev->watchdog_timeo = ISDN_NET_TX_TIMEOUT;
2593 if (register_netdev(netdev->dev) != 0) { 2616 if (register_netdev(netdev->dev) != 0) {
2594 printk(KERN_WARNING "isdn_net: Could not register net-device\n"); 2617 printk(KERN_WARNING "isdn_net: Could not register net-device\n");
@@ -2704,7 +2727,6 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
2704#else 2727#else
2705 p->dev->type = ARPHRD_PPP; /* change ARP type */ 2728 p->dev->type = ARPHRD_PPP; /* change ARP type */
2706 p->dev->addr_len = 0; 2729 p->dev->addr_len = 0;
2707 p->dev->do_ioctl = isdn_ppp_dev_ioctl;
2708#endif 2730#endif
2709 break; 2731 break;
2710 case ISDN_NET_ENCAP_X25IFACE: 2732 case ISDN_NET_ENCAP_X25IFACE:
@@ -2718,7 +2740,6 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
2718#endif 2740#endif
2719 break; 2741 break;
2720 case ISDN_NET_ENCAP_CISCOHDLCK: 2742 case ISDN_NET_ENCAP_CISCOHDLCK:
2721 p->dev->do_ioctl = isdn_ciscohdlck_dev_ioctl;
2722 break; 2743 break;
2723 default: 2744 default:
2724 if( cfg->p_encap >= 0 && 2745 if( cfg->p_encap >= 0 &&