static __initdata const char banner[] = KERN_INFO
"can: broadcast manager protocol (rev " CAN_BCM_VERSION ")\n";
-MODULE_DESCRIPTION("PF_CAN bcm sockets");
+MODULE_DESCRIPTION("PF_CAN broadcast manager protocol");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Oliver Hartkopp <oliver.hartkopp@volkswagen.de>");
struct sock *sk;
};
+static struct proc_dir_entry *proc_dir;
+
struct bcm_opt {
int bound;
int ifindex;
char procname [9]; /* pointer printed in ASCII with \0 */
};
-static struct proc_dir_entry *proc_dir = NULL;
-
#define bcm_sk(sk) ((struct bcm_opt *)&(sk)->tp_pinfo)
#define CFSIZ sizeof(struct can_frame)
if (!ifindex)
return "any";
- dev = __dev_get_by_index(ifindex); /* no usage counting */
+ /* no usage counting */
+ dev = __dev_get_by_index(ifindex);
if (dev)
return dev->name;
struct net_device *dev;
struct can_frame *cf = &op->frames[op->currframe];
+ /* no target device? => exit */
if (!op->ifindex)
- return; /* no target device -> exit */
+ return;
dev = dev_get_by_index(op->ifindex);
-
- if (!dev)
- return; /* should this bcm_op remove itself here? */
+ if (!dev) {
+ /* RFC: should this bcm_op remove itself here? */
+ return;
+ }
skb = alloc_skb(CFSIZ,
in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
if (!skb)
- goto out; /* no memory */
+ goto out;
memcpy(skb_put(skb, CFSIZ), cf, CFSIZ);
+ /* send with loopback */
skb->dev = dev;
skb->sk = op->sk;
- can_send(skb, 1); /* send with loopback */
+ can_send(skb, 1);
+ /* update statistics */
op->currframe++;
- op->frames_abs++; /* statistics */
+ op->frames_abs++;
/* reached last frame? */
if (op->currframe >= op->nframes)
{
struct sk_buff *skb;
struct can_frame *firstframe;
+ struct sockaddr_can *addr;
struct sock *sk = op->sk;
int datalen = head->nframes * CFSIZ;
- struct sockaddr_can *addr;
int err;
skb = alloc_skb(sizeof(*head) + datalen,
*/
static void bcm_tx_timeout_handler(unsigned long data)
{
- struct bcm_op *op = (struct bcm_op*)data;
+ struct bcm_op *op = (struct bcm_op *)data;
if (op->j_ival1 && (op->count > 0)) {
op->count--;
-
if (!op->count && (op->flags & TX_COUNTEVT)) {
- /* create notification to user */
-
struct bcm_msg_head msg_head;
+ /* create notification to user */
msg_head.opcode = TX_EXPIRED;
msg_head.flags = op->flags;
msg_head.count = op->count;
}
return;
-
}
/*
}
}
-
/*
* bcm_rx_timeout_handler - when the (cyclic) CAN frame receiption timed out
*/
static void bcm_rx_timeout_handler(unsigned long data)
{
- struct bcm_op *op = (struct bcm_op*)data;
+ struct bcm_op *op = (struct bcm_op *)data;
struct bcm_msg_head msg_head;
msg_head.opcode = RX_TIMEOUT;
/* clear received can_frames to indicate 'nothing received' */
memset(op->last_frames, 0, op->nframes * CFSIZ);
}
-
}
/*
*/
static void bcm_rx_thr_handler(unsigned long data)
{
- struct bcm_op *op = (struct bcm_op*)data;
+ struct bcm_op *op = (struct bcm_op *)data;
int i = 0;
op->thrtimer.expires = 0; /* mark disabled / consumed timer */
*/
static void bcm_rx_handler(struct sk_buff *skb, void *data)
{
- struct bcm_op *op = (struct bcm_op*)data;
+ struct bcm_op *op = (struct bcm_op *)data;
struct can_frame rxframe;
int i;