From b17a55096071898454d7b5b6fb30cca7faedf9f1 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Wed, 26 Nov 2008 01:35:21 +0100 Subject: ieee1394: mark all hpsb_address_ops instances as const These are never modified. Signed-off-by: Stefan Richter --- drivers/ieee1394/eth1394.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/ieee1394/eth1394.c') diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 20128692b339..7ae8bce27569 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c @@ -181,7 +181,7 @@ static void ether1394_remove_host(struct hpsb_host *host); static void ether1394_host_reset(struct hpsb_host *host); /* Function for incoming 1394 packets */ -static struct hpsb_address_ops addr_ops = { +const static struct hpsb_address_ops addr_ops = { .write = ether1394_write, }; -- cgit v1.2.3 From faf26bcc4729546ef95f5edb44f3749bb1b47d1c Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Sat, 13 Dec 2008 15:03:06 -0800 Subject: ieee1394: eth1394: trivial sparse annotations Mostly annotations of ether_type as a be16. Signed-off-by: Harvey Harrison Signed-off-by: Stefan Richter --- drivers/ieee1394/eth1394.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/ieee1394/eth1394.c') diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 7ae8bce27569..a074bfd5f825 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c @@ -92,7 +92,7 @@ struct partial_datagram { struct list_head list; u16 dgl; u16 dg_size; - u16 ether_type; + __be16 ether_type; struct sk_buff *skb; char *pbuf; struct list_head frag_info; @@ -767,7 +767,7 @@ static int ether1394_header_parse(const struct sk_buff *skb, static int ether1394_header_cache(const struct neighbour *neigh, struct hh_cache *hh) { - unsigned short type = hh->hh_type; + __be16 type = hh->hh_type; struct net_device *dev = neigh->dev; struct eth1394hdr *eth = (struct eth1394hdr *)((u8 *)hh->hh_data + 16 - ETH1394_HLEN); @@ -795,7 +795,7 @@ static void ether1394_header_cache_update(struct hh_cache *hh, ******************************************/ /* Copied from net/ethernet/eth.c */ -static u16 ether1394_type_trans(struct sk_buff *skb, struct net_device *dev) +static __be16 ether1394_type_trans(struct sk_buff *skb, struct net_device *dev) { struct eth1394hdr *eth; unsigned char *rawp; @@ -829,17 +829,17 @@ static u16 ether1394_type_trans(struct sk_buff *skb, struct net_device *dev) /* Parse an encapsulated IP1394 header into an ethernet frame packet. * We also perform ARP translation here, if need be. */ -static u16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev, +static __be16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev, nodeid_t srcid, nodeid_t destid, - u16 ether_type) + __be16 ether_type) { struct eth1394_priv *priv = netdev_priv(dev); - u64 dest_hw; - unsigned short ret = 0; + __be64 dest_hw; + __be16 ret = 0; /* Setup our hw addresses. We use these to build the ethernet header. */ if (destid == (LOCAL_BUS | ALL_NODES)) - dest_hw = ~0ULL; /* broadcast */ + dest_hw = ~cpu_to_be64(0); /* broadcast */ else dest_hw = cpu_to_be64((u64)priv->host->csr.guid_hi << 32 | priv->host->csr.guid_lo); @@ -873,7 +873,7 @@ static u16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev, node = eth1394_find_node_guid(&priv->ip_node_list, be64_to_cpu(guid)); if (!node) - return 0; + return cpu_to_be16(0); node_info = (struct eth1394_node_info *)node->ud->device.driver_data; @@ -1063,7 +1063,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid, unsigned long flags; struct eth1394_priv *priv = netdev_priv(dev); union eth1394_hdr *hdr = (union eth1394_hdr *)buf; - u16 ether_type = 0; /* initialized to clear warning */ + __be16 ether_type = cpu_to_be16(0); /* initialized to clear warning */ int hdr_len; struct unit_directory *ud = priv->ud_list[NODEID_TO_NODE(srcid)]; struct eth1394_node_info *node_info; @@ -1259,7 +1259,7 @@ static int ether1394_write(struct hpsb_host *host, int srcid, int destid, static void ether1394_iso(struct hpsb_iso *iso) { - quadlet_t *data; + __be32 *data; char *buf; struct eth1394_host_info *hi; struct net_device *dev; @@ -1283,7 +1283,7 @@ static void ether1394_iso(struct hpsb_iso *iso) for (i = 0; i < nready; i++) { struct hpsb_iso_packet_info *info = &iso->infos[(iso->first_packet + i) % iso->buf_packets]; - data = (quadlet_t *)(iso->data_buf.kvirt + info->offset); + data = (__be32 *)(iso->data_buf.kvirt + info->offset); /* skip over GASP header */ buf = (char *)data + 8; @@ -1614,7 +1614,7 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev) if (max_payload < dg_size + hdr_type_len[ETH1394_HDR_LF_UF]) priv->bc_dgl++; } else { - __be64 guid = get_unaligned((u64 *)hdr_buf.h_dest); + __be64 guid = get_unaligned((__be64 *)hdr_buf.h_dest); node = eth1394_find_node_guid(&priv->ip_node_list, be64_to_cpu(guid)); -- cgit v1.2.3 From 79994c990674edd9a1e8b2aad21e8eb8e3b43748 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 6 Jan 2009 12:54:56 +0000 Subject: ieee1394: convert to net_device_ops Convert to net_device_ops. Signed-off-by: Stephen Hemminger Acked-by: Stefan Richter Signed-off-by: David S. Miller --- drivers/ieee1394/eth1394.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'drivers/ieee1394/eth1394.c') diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 20128692b339..c5b272a5268a 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c @@ -516,16 +516,20 @@ 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_get_stats = ether1394_stats, + .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 = ðer1394_header_ops; + dev->netdev_ops = ðer1394_netdev_ops; SET_ETHTOOL_OPS(dev, ðtool_ops); -- cgit v1.2.3 From 464f4daae75c87ed281b421caa019f67f459b85f Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 6 Jan 2009 12:55:54 +0000 Subject: ieee1394: remove unneeded last_rx Last_rx is now done if needed inside bonding. Signed-off-by: Stephen Hemminger Acked-by: Stefan Richter Signed-off-by: David S. Miller --- drivers/ieee1394/eth1394.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/ieee1394/eth1394.c') diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index c5b272a5268a..471c249cff46 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c @@ -1238,8 +1238,6 @@ bad_proto: if (netif_queue_stopped(dev)) netif_wake_queue(dev); - dev->last_rx = jiffies; - return 0; } -- cgit v1.2.3 From 92dc8cc317844e5681f5d8990896720ed2b21cc8 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 6 Jan 2009 12:56:50 +0000 Subject: ieee1394: use internal network device stats Use the network_device_stats field in network_device. Signed-off-by: Stephen Hemminger Acked-by: Stefan Richter Signed-off-by: David S. Miller --- drivers/ieee1394/eth1394.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'drivers/ieee1394/eth1394.c') diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 471c249cff46..930d47f053cf 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c @@ -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) @@ -520,7 +514,6 @@ static const struct net_device_ops ether1394_netdev_ops = { .ndo_open = ether1394_open, .ndo_stop = ether1394_stop, .ndo_start_xmit = ether1394_tx, - .ndo_get_stats = ether1394_stats, .ndo_tx_timeout = ether1394_tx_timeout, .ndo_change_mtu = ether1394_change_mtu, }; @@ -1079,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; @@ -1102,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); @@ -1221,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); @@ -1511,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); @@ -1698,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); /* -- cgit v1.2.3