Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5fbbf5f6 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (84 commits)
  wimax: fix kernel-doc for debufs_dentry member of struct wimax_dev
  net: convert pegasus driver to net_device_ops
  bnx2x: Prevent eeprom set when driver is down
  net: switch kaweth driver to netdevops
  pcnet32: round off carrier watch timer
  i2400m/usb: wrap USB power saving in #ifdef CONFIG_PM
  wimax: testing for rfkill support should also test for CONFIG_RFKILL_MODULE
  wimax: fix kconfig interactions with rfkill and input layers
  wimax: fix '#ifndef CONFIG_BUG' layout to avoid warning
  r6040: bump release number to 0.20
  r6040: warn about MAC address being unset
  r6040: check PHY status when bringing interface up
  r6040: make printks consistent with DRV_NAME
  gianfar: Fixup use of BUS_ID_SIZE
  mlx4_en: Returning real Max in get_ringparam
  mlx4_en: Consider inline packets on completion
  netdev: bfin_mac: enable bfin_mac net dev driver for BF51x
  qeth: convert to net_device_ops
  vlan: add neigh_setup
  dm9601: warn on invalid mac address
  ...
parents ce279e6e 56cf391a
Loading
Loading
Loading
Loading
+25 −29
Original line number Diff line number Diff line
@@ -245,12 +245,6 @@ static int ether1394_stop(struct net_device *dev)
	return 0;
}

/* Return statistics to the caller */
static struct net_device_stats *ether1394_stats(struct net_device *dev)
{
	return &(((struct eth1394_priv *)netdev_priv(dev))->stats);
}

/* FIXME: What to do if we timeout? I think a host reset is probably in order,
 * so that's what we do. Should we increment the stat counters too?  */
static void ether1394_tx_timeout(struct net_device *dev)
@@ -516,16 +510,19 @@ static const struct header_ops ether1394_header_ops = {
	.parse		= ether1394_header_parse,
};

static const struct net_device_ops ether1394_netdev_ops = {
	.ndo_open	= ether1394_open,
	.ndo_stop	= ether1394_stop,
	.ndo_start_xmit	= ether1394_tx,
	.ndo_tx_timeout	= ether1394_tx_timeout,
	.ndo_change_mtu	= ether1394_change_mtu,
};

static void ether1394_init_dev(struct net_device *dev)
{
	dev->open		= ether1394_open;
	dev->stop		= ether1394_stop;
	dev->hard_start_xmit	= ether1394_tx;
	dev->get_stats		= ether1394_stats;
	dev->tx_timeout		= ether1394_tx_timeout;
	dev->change_mtu		= ether1394_change_mtu;

	dev->header_ops		= &ether1394_header_ops;
	dev->netdev_ops		= &ether1394_netdev_ops;

	SET_ETHTOOL_OPS(dev, &ethtool_ops);

@@ -1075,7 +1072,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
			HPSB_PRINT(KERN_ERR, "ether1394 rx: sender nodeid "
				   "lookup failure: " NODE_BUS_FMT,
				   NODE_BUS_ARGS(priv->host, srcid));
			priv->stats.rx_dropped++;
			dev->stats.rx_dropped++;
			return -1;
		}
		ud = node->ud;
@@ -1098,7 +1095,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
		skb = dev_alloc_skb(len + dev->hard_header_len + 15);
		if (unlikely(!skb)) {
			ETH1394_PRINT_G(KERN_ERR, "Out of memory\n");
			priv->stats.rx_dropped++;
			dev->stats.rx_dropped++;
			return -1;
		}
		skb_reserve(skb, (dev->hard_header_len + 15) & ~15);
@@ -1217,15 +1214,15 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
	spin_lock_irqsave(&priv->lock, flags);

	if (!skb->protocol) {
		priv->stats.rx_errors++;
		priv->stats.rx_dropped++;
		dev->stats.rx_errors++;
		dev->stats.rx_dropped++;
		dev_kfree_skb_any(skb);
	} else if (netif_rx(skb) == NET_RX_DROP) {
		priv->stats.rx_errors++;
		priv->stats.rx_dropped++;
		dev->stats.rx_errors++;
		dev->stats.rx_dropped++;
	} else {
		priv->stats.rx_packets++;
		priv->stats.rx_bytes += skb->len;
		dev->stats.rx_packets++;
		dev->stats.rx_bytes += skb->len;
	}

	spin_unlock_irqrestore(&priv->lock, flags);
@@ -1234,8 +1231,6 @@ bad_proto:
	if (netif_queue_stopped(dev))
		netif_wake_queue(dev);

	dev->last_rx = jiffies;

	return 0;
}

@@ -1509,17 +1504,18 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len)
static void ether1394_dg_complete(struct packet_task *ptask, int fail)
{
	struct sk_buff *skb = ptask->skb;
	struct eth1394_priv *priv = netdev_priv(skb->dev);
	struct net_device *dev = skb->dev;
	struct eth1394_priv *priv = netdev_priv(dev);
	unsigned long flags;

	/* Statistics */
	spin_lock_irqsave(&priv->lock, flags);
	if (fail) {
		priv->stats.tx_dropped++;
		priv->stats.tx_errors++;
		dev->stats.tx_dropped++;
		dev->stats.tx_errors++;
	} else {
		priv->stats.tx_bytes += skb->len;
		priv->stats.tx_packets++;
		dev->stats.tx_bytes += skb->len;
		dev->stats.tx_packets++;
	}
	spin_unlock_irqrestore(&priv->lock, flags);

@@ -1696,8 +1692,8 @@ fail:
		dev_kfree_skb(skb);

	spin_lock_irqsave(&priv->lock, flags);
	priv->stats.tx_dropped++;
	priv->stats.tx_errors++;
	dev->stats.tx_dropped++;
	dev->stats.tx_errors++;
	spin_unlock_irqrestore(&priv->lock, flags);

	/*
+0 −1
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ enum eth1394_bc_states { ETHER1394_BC_ERROR,

/* Private structure for our ethernet driver */
struct eth1394_priv {
	struct net_device_stats stats;	/* Device stats			 */
	struct hpsb_host *host;		/* The card for this dev	 */
	u16 bc_maxpayload;		/* Max broadcast payload	 */
	u8 bc_sspd;			/* Max broadcast speed		 */
+31 −46
Original line number Diff line number Diff line
@@ -38,16 +38,12 @@ char *hysdn_net_revision = "$Revision: 1.8.6.4 $";
/* inside the definition.                                                   */
/****************************************************************************/
struct net_local {
	struct net_device netdev;	/* the network device */
	struct net_device_stats stats;
	/* additional vars may be added here */
	char dev_name[9];	/* our own device name */

	/* Tx control lock.  This protects the transmit buffer ring
	 * state along with the "tx full" state of the driver.  This
	 * means all netif_queue flow control actions are protected
	 * by this lock as well.
	 */
	struct net_device *dev;
	spinlock_t lock;
	struct sk_buff *skbs[MAX_SKB_BUFFERS];	/* pointers to tx-skbs */
	int in_idx, out_idx;	/* indexes to buffer ring */
@@ -55,15 +51,6 @@ struct net_local {
};				/* net_local */


/*****************************************************/
/* Get the current statistics for this card.         */
/* This may be called with the card open or closed ! */
/*****************************************************/
static struct net_device_stats *
net_get_stats(struct net_device *dev)
{
	return (&((struct net_local *) dev)->stats);
}				/* net_device_stats */

/*********************************************************************/
/* Open/initialize the board. This is called (in the current kernel) */
@@ -182,8 +169,8 @@ hysdn_tx_netack(hysdn_card * card)
	if (!lp->sk_count)
		return;		/* error condition */

	lp->stats.tx_packets++;
	lp->stats.tx_bytes += lp->skbs[lp->out_idx]->len;
	lp->dev->stats.tx_packets++;
	lp->dev->stats.tx_bytes += lp->skbs[lp->out_idx]->len;

	dev_kfree_skb(lp->skbs[lp->out_idx++]);		/* free skb */
	if (lp->out_idx >= MAX_SKB_BUFFERS)
@@ -200,29 +187,30 @@ void
hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len)
{
	struct net_local *lp = card->netif;
	struct net_device *dev = lp->dev;
	struct sk_buff *skb;

	if (!lp)
		return;		/* non existing device */

	lp->stats.rx_bytes += len;
	dev->stats.rx_bytes += len;

	skb = dev_alloc_skb(len);
	if (skb == NULL) {
		printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n",
		       lp->netdev.name);
		lp->stats.rx_dropped++;
		       dev->name);
		dev->stats.rx_dropped++;
		return;
	}
	/* copy the data */
	memcpy(skb_put(skb, len), buf, len);

	/* determine the used protocol */
	skb->protocol = eth_type_trans(skb, &lp->netdev);
	skb->protocol = eth_type_trans(skb, dev);

	netif_rx(skb);
	lp->stats.rx_packets++;	/* adjust packet count */
	dev->stats.rx_packets++;	/* adjust packet count */

	netif_rx(skb);
}				/* hysdn_rx_netpkt */

/*****************************************************/
@@ -242,24 +230,15 @@ hysdn_tx_netget(hysdn_card * card)
	return (lp->skbs[lp->out_idx]);		/* next packet to send */
}				/* hysdn_tx_netget */

static const struct net_device_ops hysdn_netdev_ops = {
	.ndo_open 		= net_open,
	.ndo_stop		= net_close,
	.ndo_start_xmit		= net_send_packet,
	.ndo_change_mtu		= eth_change_mtu,
	.ndo_set_mac_address 	= eth_mac_addr,
	.ndo_validate_addr	= eth_validate_addr,
};

/*******************************************/
/* init function called by register device */
/*******************************************/
static int
net_init(struct net_device *dev)
{
	/* setup the function table */
	dev->open = net_open;
	dev->stop = net_close;
	dev->hard_start_xmit = net_send_packet;
	dev->get_stats = net_get_stats;

	/* Fill in the fields of the device structure with ethernet values. */
	ether_setup(dev);

	return (0);		/* success */
}				/* net_init */

/*****************************************************************************/
/* hysdn_net_create creates a new net device for the given card. If a device */
@@ -271,28 +250,34 @@ hysdn_net_create(hysdn_card * card)
{
	struct net_device *dev;
	int i;
	struct net_local *lp;

	if(!card) {
		printk(KERN_WARNING "No card-pt in hysdn_net_create!\n");
		return (-ENOMEM);
	}
	hysdn_net_release(card);	/* release an existing net device */
	if ((dev = kzalloc(sizeof(struct net_local), GFP_KERNEL)) == NULL) {

	dev = alloc_etherdev(sizeof(struct net_local));
	if (!dev) {
		printk(KERN_WARNING "HYSDN: unable to allocate mem\n");
		return (-ENOMEM);
	}

	lp = netdev_priv(dev);
	lp->dev = dev;

	dev->netdev_ops = &hysdn_netdev_ops;
	spin_lock_init(&((struct net_local *) dev)->lock);

	/* initialise necessary or informing fields */
	dev->base_addr = card->iobase;	/* IO address */
	dev->irq = card->irq;	/* irq */
	dev->init = net_init;	/* the init function of the device */
	if(dev->name) {
		strcpy(dev->name, ((struct net_local *) dev)->dev_name);
	} 

	dev->netdev_ops = &hysdn_netdev_ops;
	if ((i = register_netdev(dev))) {
		printk(KERN_WARNING "HYSDN: unable to create network device\n");
		kfree(dev);
		free_netdev(dev);
		return (i);
	}
	dev->ml_priv = card;	/* remember pointer to own data structure */
@@ -316,7 +301,7 @@ hysdn_net_release(hysdn_card * card)
		return (0);	/* non existing */

	card->netif = NULL;	/* clear out pointer */
	dev->stop(dev);		/* close the device */
	net_close(dev);

	flush_tx_buffers((struct net_local *) dev);	/* empty buffers */

+45 −24
Original line number Diff line number Diff line
@@ -1485,6 +1485,24 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
	return (rc);
}


static int isdn_net_ioctl(struct net_device *dev,
			  struct ifreq *ifr, int cmd)
{
	isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev);

	switch (lp->p_encap) {
#ifdef CONFIG_ISDN_PPP
	case ISDN_NET_ENCAP_SYNCPPP:
		return isdn_ppp_dev_ioctl(dev, ifr, cmd);
#endif
	case ISDN_NET_ENCAP_CISCOHDLCK:
		return isdn_ciscohdlck_dev_ioctl(dev, ifr, cmd);
	default:
		return -EINVAL;
	}
}

/* called via cisco_timer.function */
static void
isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
@@ -1998,23 +2016,6 @@ isdn_net_init(struct net_device *ndev)
	ushort max_hlhdr_len = 0;
	int drvidx;

	ether_setup(ndev);
	ndev->header_ops = NULL;

	/* Setup the generic properties */
	ndev->mtu = 1500;
	ndev->flags = IFF_NOARP|IFF_POINTOPOINT;
	ndev->type = ARPHRD_ETHER;
	ndev->addr_len = ETH_ALEN;
	ndev->validate_addr = NULL;

	/* for clients with MPPP maybe higher values better */
	ndev->tx_queue_len = 30;

	/* The ISDN-specific entries in the device structure. */
	ndev->open = &isdn_net_open;
	ndev->hard_start_xmit = &isdn_net_start_xmit;

	/*
	 *  up till binding we ask the protocol layer to reserve as much
	 *  as we might need for HL layer
@@ -2026,9 +2027,6 @@ isdn_net_init(struct net_device *ndev)
				max_hlhdr_len = dev->drv[drvidx]->interface->hl_hdrlen;

	ndev->hard_header_len = ETH_HLEN + max_hlhdr_len;
	ndev->stop = &isdn_net_close;
	ndev->get_stats = &isdn_net_get_stats;
	ndev->do_ioctl = NULL;
	return 0;
}

@@ -2508,6 +2506,19 @@ isdn_net_force_dial(char *name)
	return (isdn_net_force_dial_lp(p->local));
}

/* The ISDN-specific entries in the device structure. */
static const struct net_device_ops isdn_netdev_ops = {
	.ndo_init	      = isdn_net_init,
	.ndo_open	      = isdn_net_open,
	.ndo_stop	      = isdn_net_close,
	.ndo_do_ioctl	      = isdn_net_ioctl,

	.ndo_validate_addr    = NULL,
	.ndo_start_xmit	      = isdn_net_start_xmit,
	.ndo_get_stats	      = isdn_net_get_stats,
	.ndo_tx_timeout	      = isdn_net_tx_timeout,
};

/*
 * Helper for alloc_netdev()
 */
@@ -2515,7 +2526,20 @@ static void _isdn_setup(struct net_device *dev)
{
	isdn_net_local *lp = netdev_priv(dev);

	ether_setup(dev);

	dev->flags = IFF_NOARP | IFF_POINTOPOINT;
	/* Setup the generic properties */
	dev->mtu = 1500;
	dev->flags = IFF_NOARP|IFF_POINTOPOINT;
	dev->type = ARPHRD_ETHER;
	dev->addr_len = ETH_ALEN;
	dev->header_ops = NULL;
	dev->netdev_ops = &isdn_netdev_ops;

	/* for clients with MPPP maybe higher values better */
	dev->tx_queue_len = 30;

	lp->p_encap = ISDN_NET_ENCAP_RAWIP;
	lp->magic = ISDN_NET_MAGIC;
	lp->last = lp;
@@ -2570,7 +2594,7 @@ isdn_net_new(char *name, struct net_device *master)
		return NULL;
	}
	netdev->local = netdev_priv(netdev->dev);
	netdev->dev->init = isdn_net_init;

	if (master) {
		/* Device shall be a slave */
		struct net_device *p = MASTER_TO_SLAVE(master);
@@ -2588,7 +2612,6 @@ isdn_net_new(char *name, struct net_device *master)
		/*
		 * Watchdog timer (currently) for master only.
		 */
		netdev->dev->tx_timeout = isdn_net_tx_timeout;
		netdev->dev->watchdog_timeo = ISDN_NET_TX_TIMEOUT;
		if (register_netdev(netdev->dev) != 0) {
			printk(KERN_WARNING "isdn_net: Could not register net-device\n");
@@ -2704,7 +2727,6 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
#else
			p->dev->type = ARPHRD_PPP;	/* change ARP type */
			p->dev->addr_len = 0;
			p->dev->do_ioctl = isdn_ppp_dev_ioctl;
#endif
			break;
		case ISDN_NET_ENCAP_X25IFACE:
@@ -2718,7 +2740,6 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
#endif
			break;
		case ISDN_NET_ENCAP_CISCOHDLCK:
			p->dev->do_ioctl = isdn_ciscohdlck_dev_ioctl;
			break;
		default:
			if( cfg->p_encap >= 0 &&
+28 −29
Original line number Diff line number Diff line
@@ -125,7 +125,6 @@ static void hexdump( const unsigned char *buf, unsigned short len )

struct dvb_net_priv {
	int in_use;
	struct net_device_stats stats;
	u16 pid;
	struct net_device *net;
	struct dvb_net *host;
@@ -384,8 +383,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
				if (priv->ule_skb) {
					dev_kfree_skb( priv->ule_skb );
					/* Prepare for next SNDU. */
					priv->stats.rx_errors++;
					priv->stats.rx_frame_errors++;
					dev->stats.rx_errors++;
					dev->stats.rx_frame_errors++;
				}
				reset_ule(priv);
				priv->need_pusi = 1;
@@ -438,8 +437,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
					dev_kfree_skb( priv->ule_skb );
					/* Prepare for next SNDU. */
					// reset_ule(priv);  moved to below.
					priv->stats.rx_errors++;
					priv->stats.rx_frame_errors++;
					dev->stats.rx_errors++;
					dev->stats.rx_frame_errors++;
				}
				reset_ule(priv);
				/* skip to next PUSI. */
@@ -460,8 +459,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
						/* Drop partly decoded SNDU, reset state, resync on PUSI. */
						if (priv->ule_skb) {
							dev_kfree_skb( priv->ule_skb );
							priv->stats.rx_errors++;
							priv->stats.rx_frame_errors++;
							dev->stats.rx_errors++;
							dev->stats.rx_frame_errors++;
						}
						reset_ule(priv);
						priv->need_pusi = 1;
@@ -477,8 +476,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
				if (priv->ule_sndu_remain > 183) {
					/* Current SNDU lacks more data than there could be available in the
					 * current TS cell. */
					priv->stats.rx_errors++;
					priv->stats.rx_length_errors++;
					dev->stats.rx_errors++;
					dev->stats.rx_length_errors++;
					printk(KERN_WARNING "%lu: Expected %d more SNDU bytes, but "
					       "got PUSI (pf %d, ts_remain %d).  Flushing incomplete payload.\n",
					       priv->ts_count, priv->ule_sndu_remain, ts[4], ts_remain);
@@ -520,8 +519,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
				if (priv->ule_sndu_len < 5) {
					printk(KERN_WARNING "%lu: Invalid ULE SNDU length %u. "
					       "Resyncing.\n", priv->ts_count, priv->ule_sndu_len);
					priv->stats.rx_errors++;
					priv->stats.rx_length_errors++;
					dev->stats.rx_errors++;
					dev->stats.rx_length_errors++;
					priv->ule_sndu_len = 0;
					priv->need_pusi = 1;
					new_ts = 1;
@@ -573,7 +572,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
			if (priv->ule_skb == NULL) {
				printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n",
				       dev->name);
				priv->stats.rx_dropped++;
				dev->stats.rx_dropped++;
				return;
			}

@@ -637,8 +636,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
				ule_dump = 1;
#endif

				priv->stats.rx_errors++;
				priv->stats.rx_crc_errors++;
				dev->stats.rx_errors++;
				dev->stats.rx_crc_errors++;
				dev_kfree_skb(priv->ule_skb);
			} else {
				/* CRC32 verified OK. */
@@ -744,8 +743,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
				 * receive the packet anyhow. */
				/* if (priv->ule_dbit && skb->pkt_type == PACKET_OTHERHOST)
					priv->ule_skb->pkt_type = PACKET_HOST; */
				priv->stats.rx_packets++;
				priv->stats.rx_bytes += priv->ule_skb->len;
				dev->stats.rx_packets++;
				dev->stats.rx_bytes += priv->ule_skb->len;
				netif_rx(priv->ule_skb);
			}
			sndu_done:
@@ -800,8 +799,7 @@ static void dvb_net_sec(struct net_device *dev,
{
	u8 *eth;
	struct sk_buff *skb;
	struct net_device_stats *stats =
		&((struct dvb_net_priv *) netdev_priv(dev))->stats;
	struct net_device_stats *stats = &dev->stats;
	int snap = 0;

	/* note: pkt_len includes a 32bit checksum */
@@ -1216,28 +1214,29 @@ static int dvb_net_stop(struct net_device *dev)
	return dvb_net_feed_stop(dev);
}

static struct net_device_stats * dvb_net_get_stats(struct net_device *dev)
{
	return &((struct dvb_net_priv *) netdev_priv(dev))->stats;
}

static const struct header_ops dvb_header_ops = {
	.create		= eth_header,
	.parse		= eth_header_parse,
	.rebuild	= eth_rebuild_header,
};


static const struct net_device_ops dvb_netdev_ops = {
	.ndo_open		= dvb_net_open,
	.ndo_stop		= dvb_net_stop,
	.ndo_start_xmit		= dvb_net_tx,
	.ndo_set_multicast_list = dvb_net_set_multicast_list,
	.ndo_set_mac_address    = dvb_net_set_mac,
	.ndo_change_mtu		= eth_change_mtu,
	.ndo_validate_addr	= eth_validate_addr,
};

static void dvb_net_setup(struct net_device *dev)
{
	ether_setup(dev);

	dev->header_ops		= &dvb_header_ops;
	dev->open		= dvb_net_open;
	dev->stop		= dvb_net_stop;
	dev->hard_start_xmit	= dvb_net_tx;
	dev->get_stats		= dvb_net_get_stats;
	dev->set_multicast_list = dvb_net_set_multicast_list;
	dev->set_mac_address    = dvb_net_set_mac;
	dev->netdev_ops		= &dvb_netdev_ops;
	dev->mtu		= 4096;
	dev->mc_count           = 0;

Loading