projects
/
cascardo
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
arcnet: Move files out of include/linux
[cascardo/linux.git]
/
drivers
/
net
/
arcnet
/
arc-rawmode.c
diff --git
a/drivers/net/arcnet/arc-rawmode.c
b/drivers/net/arcnet/arc-rawmode.c
index
705e6ce
..
35a747a
100644
(file)
--- a/
drivers/net/arcnet/arc-rawmode.c
+++ b/
drivers/net/arcnet/arc-rawmode.c
@@
-1,6
+1,6
@@
/*
* Linux ARCnet driver - "raw mode" packet encapsulation (no soft headers)
/*
* Linux ARCnet driver - "raw mode" packet encapsulation (no soft headers)
- *
+ *
* Written 1994-1999 by Avery Pennarun.
* Derived from skeleton.c by Donald Becker.
*
* Written 1994-1999 by Avery Pennarun.
* Derived from skeleton.c by Donald Becker.
*
@@
-24,6
+24,8
@@
* **********************
*/
* **********************
*/
+#define pr_fmt(fmt) "arcnet:" KBUILD_MODNAME ": " fmt
+
#include <linux/module.h>
#include <linux/gfp.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/gfp.h>
#include <linux/init.h>
@@
-31,10
+33,8
@@
#include <net/arp.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <net/arp.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
-#include <linux/arcdevice.h>
-
-#define VERSION "arcnet: raw mode (`r') encapsulation support loaded.\n"
+#include "arcdevice.h"
static void rx(struct net_device *dev, int bufnum,
struct archdr *pkthdr, int length);
static void rx(struct net_device *dev, int bufnum,
struct archdr *pkthdr, int length);
@@
-43,8
+43,7
@@
static int build_header(struct sk_buff *skb, struct net_device *dev,
static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
int bufnum);
static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
int bufnum);
-static struct ArcProto rawmode_proto =
-{
+static struct ArcProto rawmode_proto = {
.suffix = 'r',
.mtu = XMTU,
.rx = rx,
.suffix = 'r',
.mtu = XMTU,
.rx = rx,
@@
-54,12
+53,11
@@
static struct ArcProto rawmode_proto =
.ack_tx = NULL
};
.ack_tx = NULL
};
-
static int __init arcnet_raw_init(void)
{
int count;
static int __init arcnet_raw_init(void)
{
int count;
- pr
intk(VERSION
);
+ pr
_info("%s\n", "raw mode (`r') encapsulation support loaded"
);
for (count = 0; count < 256; count++)
if (arc_proto_map[count] == arc_proto_default)
for (count = 0; count < 256; count++)
if (arc_proto_map[count] == arc_proto_default)
@@
-83,7
+81,6
@@
module_exit(arcnet_raw_exit);
MODULE_LICENSE("GPL");
MODULE_LICENSE("GPL");
-
/* packet receiver */
static void rx(struct net_device *dev, int bufnum,
struct archdr *pkthdr, int length)
/* packet receiver */
static void rx(struct net_device *dev, int bufnum,
struct archdr *pkthdr, int length)
@@
-93,7
+90,7
@@
static void rx(struct net_device *dev, int bufnum,
struct archdr *pkt = pkthdr;
int ofs;
struct archdr *pkt = pkthdr;
int ofs;
-
BUGMSG(D_DURING
, "it's a raw packet (length=%d)\n", length);
+
arc_printk(D_DURING, dev
, "it's a raw packet (length=%d)\n", length);
if (length > MTU)
ofs = 512 - length;
if (length > MTU)
ofs = 512 - length;
@@
-101,15
+98,14
@@
static void rx(struct net_device *dev, int bufnum,
ofs = 256 - length;
skb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
ofs = 256 - length;
skb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
- if (skb == NULL) {
- BUGMSG(D_NORMAL, "Memory squeeze, dropping packet.\n");
+ if (!skb) {
dev->stats.rx_dropped++;
return;
}
skb_put(skb, length + ARC_HDR_SIZE);
skb->dev = dev;
dev->stats.rx_dropped++;
return;
}
skb_put(skb, length + ARC_HDR_SIZE);
skb->dev = dev;
- pkt = (struct archdr *)
skb->data;
+ pkt = (struct archdr *)skb->data;
skb_reset_mac_header(skb);
skb_pull(skb, ARC_HDR_SIZE);
skb_reset_mac_header(skb);
skb_pull(skb, ARC_HDR_SIZE);
@@
-121,38
+117,35
@@
static void rx(struct net_device *dev, int bufnum,
pkt->soft.raw + sizeof(pkt->soft),
length - sizeof(pkt->soft));
pkt->soft.raw + sizeof(pkt->soft),
length - sizeof(pkt->soft));
- BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx");
+ if (BUGLVL(D_SKB))
+ arcnet_dump_skb(dev, skb, "rx");
skb->protocol = cpu_to_be16(ETH_P_ARCNET);
netif_rx(skb);
}
skb->protocol = cpu_to_be16(ETH_P_ARCNET);
netif_rx(skb);
}
-
-/*
- * Create the ARCnet hard/soft headers for raw mode.
+/* Create the ARCnet hard/soft headers for raw mode.
* There aren't any soft headers in raw mode - not even the protocol id.
*/
static int build_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, uint8_t daddr)
{
int hdr_size = ARC_HDR_SIZE;
* There aren't any soft headers in raw mode - not even the protocol id.
*/
static int build_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, uint8_t daddr)
{
int hdr_size = ARC_HDR_SIZE;
- struct archdr *pkt = (struct archdr *)
skb_push(skb, hdr_size);
+ struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size);
- /*
- * Set the source hardware address.
+ /* Set the source hardware address.
*
* This is pretty pointless for most purposes, but it can help in
*
* This is pretty pointless for most purposes, but it can help in
- * debugging. ARCnet does not allow us to change the source address
in
- *
the actual packet sent)
+ * debugging. ARCnet does not allow us to change the source address
+ *
in the actual packet sent.
*/
pkt->hard.source = *dev->dev_addr;
/* see linux/net/ethernet/eth.c to see where I got the following */
if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
*/
pkt->hard.source = *dev->dev_addr;
/* see linux/net/ethernet/eth.c to see where I got the following */
if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
- /*
- * FIXME: fill in the last byte of the dest ipaddr here to better
- * comply with RFC1051 in "noarp" mode.
+ /* FIXME: fill in the last byte of the dest ipaddr here
+ * to better comply with RFC1051 in "noarp" mode.
*/
pkt->hard.dest = 0;
return hdr_size;
*/
pkt->hard.dest = 0;
return hdr_size;
@@
-163,7
+156,6
@@
static int build_header(struct sk_buff *skb, struct net_device *dev,
return hdr_size; /* success */
}
return hdr_size; /* success */
}
-
static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
int bufnum)
{
static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
int bufnum)
{
@@
-171,15
+163,16
@@
static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
struct arc_hardware *hard = &pkt->hard;
int ofs;
struct arc_hardware *hard = &pkt->hard;
int ofs;
-
BUGMSG(D_DURING
, "prepare_tx: txbufs=%d/%d/%d\n",
- lp->next_tx, lp->cur_tx, bufnum);
+
arc_printk(D_DURING, dev
, "prepare_tx: txbufs=%d/%d/%d\n",
+
lp->next_tx, lp->cur_tx, bufnum);
- length -= ARC_HDR_SIZE; /* hard header is not included in packet length */
+ /* hard header is not included in packet length */
+ length -= ARC_HDR_SIZE;
if (length > XMTU) {
/* should never happen! other people already check for this. */
if (length > XMTU) {
/* should never happen! other people already check for this. */
-
BUGMSG(D_NORMAL
, "Bug! prepare_tx with size %d (> %d)\n",
- length, XMTU);
+
arc_printk(D_NORMAL, dev
, "Bug! prepare_tx with size %d (> %d)\n",
+
length, XMTU);
length = XMTU;
}
if (length >= MinTU) {
length = XMTU;
}
if (length >= MinTU) {
@@
-188,11
+181,12
@@
static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
} else if (length > MTU) {
hard->offset[0] = 0;
hard->offset[1] = ofs = 512 - length - 3;
} else if (length > MTU) {
hard->offset[0] = 0;
hard->offset[1] = ofs = 512 - length - 3;
- } else
+ } else
{
hard->offset[0] = ofs = 256 - length;
hard->offset[0] = ofs = 256 - length;
+ }
-
BUGMSG(D_DURING
, "prepare_tx: length=%d ofs=%d\n",
-
length,
ofs);
+
arc_printk(D_DURING, dev
, "prepare_tx: length=%d ofs=%d\n",
+
length,
ofs);
lp->hw.copy_to_card(dev, bufnum, 0, hard, ARC_HDR_SIZE);
lp->hw.copy_to_card(dev, bufnum, ofs, &pkt->soft, length);
lp->hw.copy_to_card(dev, bufnum, 0, hard, ARC_HDR_SIZE);
lp->hw.copy_to_card(dev, bufnum, ofs, &pkt->soft, length);