Hi Jorge,
some review on your latest patch.
Jorge Almeida wrote:
> -----------------------------------------------------------------------=
-
>=20
> Index: stack/include/rtnet_socket.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- stack/include/rtnet_socket.h (revision 1060)
> +++ stack/include/rtnet_socket.h (working copy)
> @@ -48,14 +48,14 @@
> =20
> rtdm_lock_t param_lock;
> =20
> - unsigned int priority;
> - nanosecs_rel_t timeout; /* receive timeout, 0 for infi=
nite */
> + volatile unsigned int priority;
> + nanosecs_t timeout; /* receive timeout, 0 for infi=
nite */
Please kill those downgrades to a pre-0.9.5 era.
> =20
> rtdm_sem_t pending_sem;
> #ifdef CONFIG_RTNET_RTDM_SELECT
> wait_queue_primitive_t *wakeup_select; /* for selecting calls - t=
his
> - SHOULD be the head of a=
wait
> - queue mechanism. */
> + SHOULD be the head of a wait
> + queue mechanism. */
Whitespace changes ought to be avoided.
> #endif /* CONFIG_RTNET_RTDM_SELECT*/
> =20
> void (*callback_func)(struct rtdm_dev_context *=
,
> @@ -78,7 +78,7 @@
> /* packet socket specific */
> struct {
> struct rtpacket_type packet_type;
> - int ifindex;
> + volatile int ifindex;
Please update.
> } packet;
> } prot;
> };
> @@ -104,4 +104,7 @@
> rtdm_user_info_t *user_info,
> int request, void *arg);
> =20
> +#define PACKET_SOCKET "PACKET_SOCKET"
> +#define PACKET_SOCKET_LENGTH 13
> +
Mmh, that's part of a story I do not fully understand yet.
> #endif /* __RTNET_SOCKET_H_ */
> Index: stack/include/rtskb.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- stack/include/rtskb.h (revision 1060)
> +++ stack/include/rtskb.h (working copy)
> @@ -166,12 +166,12 @@
> struct rtsocket *sk; /* assigned socket */
> struct rtnet_device *rtdev; /* source or destination device */=
> =20
> - nanosecs_abs_t time_stamp; /* arrival or transmission (RTcap)=
time */
> + nanosecs_t time_stamp; /* arrival or transmission (RTcap)=
time */
> =20
> /* patch address of the transmission time stamp, can be NULL
> * calculation: *xmit_stamp =3D cpu_to_be64(time_in_ns + *xmit_sta=
mp)
> */
> - nanosecs_abs_t *xmit_stamp;
> + nanosecs_t *xmit_stamp;
> =20
> /* transport layer */
> union
> @@ -223,7 +223,7 @@
> struct rtskb *cap_next; /* used for capture queue =
*/
> unsigned char *cap_start; /* start offset for capturing =
*/
> unsigned int cap_len; /* capture length of this rtskb =
*/
> - nanosecs_abs_t cap_rtmac_stamp; /* RTmac enqueuing time =
*/
> + nanosecs_t cap_rtmac_stamp; /* RTmac enqueuing time =
*/
> #endif
> };
> =20
To be killed.
> @@ -728,6 +728,7 @@
> extern unsigned int rtskb_pool_shrink_rt(struct rtskb_queue *pool,
> unsigned int rem_rtskbs);
> extern int rtskb_acquire(struct rtskb *rtskb, struct rtskb_queue *comp=
_pool);
> +extern int rtskb_clone(struct rtskb *rtskb_1,struct rtskb *rtskb_2,str=
uct rtskb_queue *pool);
> =20
> extern int rtskb_pools_init(void);
> extern void rtskb_pools_release(void);
> Index: stack/stack_mgr.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- stack/stack_mgr.c (revision 1060)
> +++ stack/stack_mgr.c (working copy)
> @@ -27,6 +27,7 @@
> #include <rtnet_internal.h>
> #include <rtskb_fifo.h>
> #include <stack_mgr.h>
> +#include <rtnet_socket.h>
See my comment on the SOCK_RAW patch (fatal layering violation...)
> =20
> =20
> static unsigned int stack_mgr_prio =3D RTNET_DEF_STACK_PRIORITY;
> @@ -54,15 +55,13 @@
> int ret =3D 0;
> rtdm_lockctx_t context;
> =20
> -
> - if (pt->type =3D=3D htons(ETH_P_ALL))
> + if (likely(pt->type =3D=3D htons(ETH_P_ALL) && (strncmp(pt->name,P=
ACKET_SOCKET,PACKET_SOCKET_LENGTH) !=3D 0 )))
> return -EINVAL;
Please explain: what's the idea of this string comparison?
The name field in rtpacket_type is probably something we should rather
kill at this chance - it's only set but doesn't seem to be read anymore
(or never was actually).
> =20
> INIT_LIST_HEAD(&pt->list_entry);
> pt->refcount =3D 0;
> =20
> hash =3D ntohs(pt->type) & RTPACKET_HASH_KEY_MASK;
> -
> rtdm_lock_get_irqsave(&rt_packets_lock, context);
> list_add_tail(&pt->list_entry, &rt_packets[hash]);
> rtdm_lock_put_irqrestore(&rt_packets_lock, context);
> @@ -83,8 +82,7 @@
> =20
> =20
> RTNET_ASSERT(pt !=3D NULL, return -EINVAL;);
> -
> - if (pt->type =3D=3D htons(ETH_P_ALL))
> + if (likely(pt->type =3D=3D htons(ETH_P_ALL) && (strncmp(pt->name,P=
ACKET_SOCKET,PACKET_SOCKET_LENGTH) !=3D 0 )))
> return -EINVAL;
See above.
> =20
> rtdm_lock_get_irqsave(&rt_packets_lock, context);
> @@ -119,7 +117,6 @@
> rtdev_reference(rtdev);
> =20
> if (unlikely(rtskb_fifo_insert_inirq(&rx.fifo, skb) < 0)) {
> - rtdm_printk("RTnet: dropping packet in %s()\n", __FUNCTION__);=
Why? Maybe we can create some warn-once, but we need an alarm that the
system was misdesigned (too few buffers or too high load).
> kfree_rtskb(skb);
> rtdev_dereference(rtdev);
> }
> @@ -153,7 +150,6 @@
> struct rtnet_device *rtdev;
> int err;
> =20
> -
> while (rtdm_event_wait(mgr_event) =3D=3D 0)
> while (1) {
> next_packet:
> @@ -161,33 +157,46 @@
> skb =3D __rtskb_fifo_remove(&rx.fifo);
> if (!skb)
> break;
> -
> rtdev =3D skb->rtdev;
> =20
> rtcap_report_incoming(skb);
> =20
> skb->nh.raw =3D skb->data;
> =20
> + /*hash for the ETH_P_ALL packets*/
> + hash =3D ETH_P_ALL & RTPACKET_HASH_KEY_MASK;
> + rtdm_lock_get_irqsave(&rt_packets_lock, context);
> + /*for cycle that runs over all list entries to check if an=
yone has ETH_P_ALL for protocol type*/
> + list_for_each_entry(pt_entry, &rt_packets[hash], list_entr=
y)
It's better to keep ETH_P_ALL separated from normal subscribers. If some
protocol matches the hash key of ETH_P_ALL, we but that subscriber
without any needs into this hotpath.
> + {
> + if ( likely(ntohs(pt_entry->type) =3D=3D hash &&=20
> + (strncmp(pt_entry->name,PACKET_SOCKET,PACKET_SOCK=
ET_LENGTH) =3D=3D 0 )))
> + {
> + pt_entry->refcount++;
> + rtdm_lock_put_irqrestore(&rt_packets_lock, context=
);
> + err =3D pt_entry->handler(skb, pt_entry);
> + rtdm_lock_get_irqsave(&rt_packets_lock, context);
> + pt_entry->refcount--;
> + rtdm_lock_put_irqrestore(&rt_packets_lock, context=
);
The last lock_put is bogus, remove it.
> + }
> + }
> + rtdm_lock_put_irqrestore(&rt_packets_lock, context);
> + =20
> hash =3D ntohs(skb->protocol) & RTPACKET_HASH_KEY_MASK;
> -
> rtdm_lock_get_irqsave(&rt_packets_lock, context);
Don't drop and reacquire the same lock here. [And even if we go for a
separate list of ETH_P_ALL listeners: we should use the same lock for it
as well.]
> -
> + /*for cycle that runs over all list entries*/
> list_for_each_entry(pt_entry, &rt_packets[hash], list_entr=
y)
> if (pt_entry->type =3D=3D skb->protocol) {
> pt_entry->refcount++;
> rtdm_lock_put_irqrestore(&rt_packets_lock, context=
);
> -
> err =3D pt_entry->handler(skb, pt_entry);
> -
> rtdm_lock_get_irqsave(&rt_packets_lock, context);
> pt_entry->refcount--;
> rtdm_lock_put_irqrestore(&rt_packets_lock, context=
);
> -
> rtdev_dereference(rtdev);
> if (!err)
> goto next_packet;
> }
> -
Please kill all those code layout changes like the above. They exist to
improve the readability.
> rtdm_lock_put_irqrestore(&rt_packets_lock, context);
> =20
> /* don't warn if running in promiscuous mode (RTcap...?) *=
/
> Index: stack/rtskb.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- stack/rtskb.c (revision 1060)
> +++ stack/rtskb.c (working copy)
> @@ -483,8 +483,34 @@
> return 0;
> }
> =20
> +/** Clone a rtskb to another, allocating a rtskb for the copy */
> +int rtskb_clone(struct rtskb *rtskb_1,struct rtskb *rtskb_2,struct rts=
kb_queue *pool)
Please rename, e.g. rtskb_1 -> rtskb_new, rtskb_2 -> rtskb.
> +{
> + if(rtskb_1 =3D=3D NULL)
> + return -ENOMEM;
Mmh, wouldn't it make sense to also allocate the rtskb here and return
the pointer? That's what Linux does as well. The prototype would then
look like this:
struct rtskb *rtskb_clone(struct rtskb *rtskb, struct rtskb_queue *pool)
> =20
> + rtskb_1->chain_end =3D rtskb_1;
Done on allocation - unless you manage rtskbs in your own secrete queue
(which you don't).
> + memcpy(rtskb_1->data, rtskb_2->data, rtskb_2->len );
That looks wrong. The original rtskb may have already forwarded its data
pointer past the MAC header, and the same must happen to the clone. You
have to account for the current data vs. the mac.raw, copy the full
block to the target, and then move the data pointer of the target
accordingly.
> + rtskb_1->len =3D rtskb_2->len;
> + rtskb_1->time_stamp =3D rtskb_2->time_stamp;
> + rtskb_1->rtdev =3D rtskb_2->rtdev;
> + rtskb_1->protocol =3D rtskb_2->protocol;
> + rtskb_1->pool =3D pool;
rtskb_1->pool is already valid and points to pool, see alloc_rtskb.
> + rtskb_1->pkt_type =3D rtskb_2->pkt_type;
> + rtskb_1->priority =3D rtskb_2->priority;
> + rtskb_1->ip_summed =3D rtskb_2->ip_summed;
> + rtskb_1->csum =3D rtskb_2->csum;
> + =20
> + /*copy ethernet stuff*/
> + rtskb_1->mac.raw =3D rtskb_1->data;
Likely bogus, see above.
> + memcpy(rtskb_1->mac.ethernet->h_dest,rtskb_2->mac.ethernet->h_dest=
, ETH_ALEN);
> + memcpy(rtskb_1->mac.ethernet->h_source,rtskb_2->mac.ethernet->h_so=
urce, ETH_ALEN);
See above.
> + rtskb_1->mac.ethernet->h_proto =3D rtskb_2->mac.ethernet->h_proto;=
To be really generic, you would also have to clone rtskb.h and .nh -
even if the original rtskb contains garbage in this regard.
> + =20
> + return 0;
> +}
> =20
> +
> int rtskb_pools_init(void)
> {
> rtskb_slab_pool =3D kmem_cache_create("rtskb_slab_pool",
> @@ -547,6 +573,7 @@
> EXPORT_SYMBOL(global_pool);
> =20
> EXPORT_SYMBOL(rtskb_acquire);
> +EXPORT_SYMBOL(rtskb_clone);
> =20
> #ifdef CONFIG_RTNET_CHECKED
> EXPORT_SYMBOL(rtskb_over_panic);
> Index: stack/packet/af_packet.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- stack/packet/af_packet.c (revision 1060)
> +++ stack/packet/af_packet.c (working copy)
> @@ -43,31 +43,53 @@
> void (*callback_func)(struct rtdm_dev_context *, void *=
);
> void *callback_arg;
> rtdm_lockctx_t context;
> -
> -
> + struct rtskb *clone_skb =3D NULL;
> + unsigned short hash =3D 0;
> + int err =3D -1;
> + =20
> if (unlikely((ifindex !=3D 0) && (ifindex !=3D skb->rtdev->ifindex=
)))
> return EUNATCH;
> + =20
> + /*hash for the ETH_P_ALL packets*/
> + hash =3D ETH_P_ALL & RTPACKET_HASH_KEY_MASK;
> + if(likely(ntohs(pt->type) =3D=3D hash &&=20
> + (strncmp(pt->name,PACKET_SOCKET,PACKET_SOCKET_LENGTH) =3D=3D 0 =
)))
> + {
> + clone_skb =3D alloc_rtskb(skb->len,&sock->skb_pool);
> + if(clone_skb =3D=3D NULL) return -ENOMEM;
> + rtdm_lock_get_irqsave(&rt_packets_lock, context);
> + err =3D rtskb_clone(clone_skb, skb, &sock->skb_pool);
> + rtdm_lock_put_irqrestore(&rt_packets_lock, context);
What's the lock protecting?
> + }
> + else
> + {
> + err =3D rtskb_acquire(skb, &sock->skb_pool);
> + clone_skb =3D skb;
> + }
> =20
> - if (unlikely(rtskb_acquire(skb, &sock->skb_pool) !=3D 0))
> - kfree_rtskb(skb);
> - else {
> - rtdev_reference(skb->rtdev);
> - rtskb_queue_tail(&sock->incoming, skb);
> + if ( err !=3D 0)
> + {
> + kfree_rtskb(clone_skb);
> + }
> + else=20
> + {
> + rtdev_reference(clone_skb->rtdev);
> + rtskb_queue_tail(&sock->incoming, clone_skb);
> + =20
> rtdm_sem_up(&sock->pending_sem);
> =20
> rtdm_lock_get_irqsave(&sock->param_lock, context);
> callback_func =3D sock->callback_func;
> callback_arg =3D sock->callback_arg;
> rtdm_lock_put_irqrestore(&sock->param_lock, context);
> -
> if (callback_func)
> + {
> callback_func(rt_socket_context(sock), callback_arg);
> + }
> }
> return 0;
> }
> =20
> -
> -
> /***
> * rt_packet_bind
> */
> @@ -89,7 +111,7 @@
> =20
> rtdm_lock_get_irqsave(&sock->param_lock, context);
> =20
> - /* release exisiting binding */
> + /* release existing binding */
That's an unrelated fix I accept. :)
> if ((pt->type !=3D 0) && ((ret =3D rtdev_remove_pack(pt)) < 0)) {
> rtdm_lock_put_irqrestore(&sock->param_lock, context);
> return ret;
> @@ -100,7 +122,7 @@
> =20
> /* if protocol is non-zero, register the packet type */
> if (sock->protocol !=3D 0) {
> - pt->name =3D "PACKET_SOCKET";
> + pt->name =3D PACKET_SOCKET;
> pt->handler =3D rt_packet_rcv;
> pt->err_handler =3D NULL;
> =20
> @@ -169,13 +191,13 @@
> =20
> if ((ret =3D rt_socket_init(sockctx)) !=3D 0)
> return ret;
> -
> + =20
> sock->prot.packet.packet_type.type =3D protocol;
> sock->prot.packet.ifindex =3D 0;
> =20
> /* if protocol is non-zero, register the packet type */
> if (protocol !=3D 0) {
> - sock->prot.packet.packet_type.name =3D "PACKET_SOCKET";=
> + sock->prot.packet.packet_type.name =3D PACKET_SOCKET;
> sock->prot.packet.packet_type.handler =3D rt_packet_rcv;
> sock->prot.packet.packet_type.err_handler =3D NULL;
> =20
> @@ -271,13 +293,12 @@
> struct ethhdr *eth;
> struct sockaddr_ll *sll;
> int ret;
> - nanosecs_abs_t timeout =3D sock->timeout;
> + nanosecs_t timeout =3D sock->timeout;
> =20
> -
> /* non-blocking receive? */
> if (testbits(msg_flags, MSG_DONTWAIT))
> timeout =3D -1;
> -
> + =20
> ret =3D rtdm_sem_timeddown(&sock->pending_sem, timeout, NULL);
> if (unlikely(ret < 0)) {
> if ((ret !=3D -EWOULDBLOCK) && (ret !=3D -ETIMEDOUT))
> @@ -287,9 +308,7 @@
> =20
> skb =3D rtskb_dequeue_chain(&sock->incoming);
> RTNET_ASSERT(skb !=3D NULL, return -EFAULT;);
> -
> eth =3D skb->mac.ethernet;
> -
> sll =3D msg->msg_name;
> =20
> /* copy the address */
> @@ -313,10 +332,38 @@
> copy_len =3D len;
> msg->msg_flags |=3D MSG_TRUNC;
> }
> + =20
> + if(sockctx->device->socket_type =3D=3D SOCK_DGRAM)
> + {
> + /* copy the data */
> + rt_memcpy_tokerneliovec(msg->msg_iov, skb->data, copy_len);
> + }
> + else if (sockctx->device->socket_type =3D=3D SOCK_RAW)
> + {
> + int nBufferLen =3D 0;
> + unsigned char puchBuffer[ETH_FRAME_LEN] =3D {0};
> + =20
> + memcpy((puchBuffer+nBufferLen), eth->h_dest,ETH_ALEN);
> + nBufferLen +=3D ETH_ALEN;
> =20
> - /* copy the data */
> - rt_memcpy_tokerneliovec(msg->msg_iov, skb->data, copy_len);
> + memcpy((puchBuffer+nBufferLen), eth->h_source,ETH_ALEN);
> + nBufferLen +=3D ETH_ALEN;
> =20
> + memcpy((puchBuffer+nBufferLen), &(eth->h_proto),2);
> + nBufferLen +=3D 2;
> +
> + memcpy((puchBuffer+nBufferLen), skb->data, copy_len);
> + nBufferLen +=3D copy_len;
> +
> + /* copy the data to user */ =20
> + rt_memcpy_tokerneliovec(msg->msg_iov, puchBuffer, nBufferLen);=
> + /* new buffer length*/
> + real_len =3D nBufferLen;
> + }
> + else
> + {
> + rtdm_printk("Packet: Socket type Not Supported\n");
> + }
> if ((msg_flags & MSG_PEEK) =3D=3D 0) {
> rtdev_dereference(skb->rtdev);
> kfree_rtskb(skb);
> @@ -324,7 +371,6 @@
> rtskb_queue_head(&sock->incoming, skb);
> rtdm_sem_up(&sock->pending_sem);
> }
> -
> return real_len;
> }
> =20
> @@ -383,13 +429,34 @@
> =20
> rtskb->rtdev =3D rtdev;
> rtskb->priority =3D sock->priority;
> -
> - if (rtdev->hard_header) {
> - ret =3D rtdev->hard_header(rtskb, rtdev, ntohs(sll->sll_protoc=
ol),
> - sll->sll_addr, rtdev->dev_addr, rtskb=
->len);
> - if (ret < 0)
> - goto err;
> + // SOCK_DGRAM
> + if(sockctx->device->socket_type =3D=3D SOCK_DGRAM)
> + {
> + if (rtdev->hard_header) {
> + ret =3D rtdev->hard_header(rtskb, rtdev, ntohs(sll->sll_pr=
otocol),
> + sll->sll_addr, rtdev->dev_addr, rt=
skb->len);
> + if (ret < 0)
> + goto err;
> + }
> }
> + // SOCK_RAW
> + else if (sockctx->device->socket_type =3D=3D SOCK_RAW)
> + {
> + unsigned char puchBuffer[ETH_FRAME_LEN];
> + if (rtdev->hard_header) {
> + ret =3D rtdev->hard_header(rtskb, rtdev, (unsigned short)*=
(rtskb->data+ETH_ALEN+ETH_ALEN),
> + sll->sll_addr, (rtskb->data+ETH_A=
LEN), (rtskb->len - ETH_HLEN));
> + if (ret < 0)
> + goto err;
> + }
> + memcpy(puchBuffer,rtskb->data,rtskb->len);
> + memcpy(rtskb->data,(puchBuffer+ETH_HLEN),(rtskb->len - ETH_HLE=
N));
> + rtskb->len =3D rtskb->len - ETH_HLEN;
> + }
> + else
> + {
> + rtdm_printk("Packet: Socket type Not Supported\n");
> + }
Regarding all this above: see earlier review.
> =20
> if ((rtdev->flags & IFF_UP) !=3D 0) {
> if ((ret =3D rtdev_xmit(rtskb)) =3D=3D 0)
> @@ -409,8 +476,6 @@
> return ret;
> }
> =20
> -
> -
> static struct rtdm_device packet_proto_dev =3D {
> struct_version: RTDM_DEVICE_STRUCT_VER,
> =20
> @@ -430,7 +495,7 @@
> ioctl_nrt: rt_packet_ioctl,
> recvmsg_rt: rt_packet_recvmsg,
> sendmsg_rt: rt_packet_sendmsg
> - },
> +},
> =20
> device_class: RTDM_CLASS_NETWORK,
> device_sub_class: RTDM_SUBCLASS_RTNET,
> @@ -443,15 +508,55 @@
> };
> =20
> =20
> +static struct rtdm_device raw_packet_proto_dev =3D {
> + struct_version: RTDM_DEVICE_STRUCT_VER,
> +
> + device_flags: RTDM_PROTOCOL_DEVICE,
> + context_size: sizeof(struct rtsocket),
> +
> + protocol_family: PF_PACKET,
> + socket_type: SOCK_RAW,
> +
> + socket_rt: rt_packet_socket,
> + socket_nrt: rt_packet_socket,
> +
> + ops: {
> + close_rt: rt_packet_close,
> + close_nrt: rt_packet_close,
> + ioctl_rt: rt_packet_ioctl,
> + ioctl_nrt: rt_packet_ioctl,
> + recvmsg_rt: rt_packet_recvmsg,
> + sendmsg_rt: rt_packet_sendmsg
> + },
> +
> + device_class: RTDM_CLASS_NETWORK,
> + device_sub_class: RTDM_SUBCLASS_RTNET,
> + driver_name: "rtpacket",
> + driver_version: RTNET_RTDM_VER,
> + peripheral_name: "Real-Time Packet Socket Interface",
> + provider_name: rtnet_rtdm_provider_name,
> +
> + proc_name: "PACKET_RAW"
> +};
> +
> +
> int __init rt_packet_proto_init(void)
> {
> - return rtdm_dev_register(&packet_proto_dev);
> + int nReturn =3D -1;
> + nReturn =3D rtdm_dev_register(&packet_proto_dev);
> + if(nReturn !=3D 0)
> + rtdm_printk("Error registing DGRAM socket. Return =3D %d\n",nRetu=
rn);
> + nReturn =3D rtdm_dev_register(&raw_packet_proto_dev);
> + if(nReturn !=3D 0)
> + rtdm_printk("Error registing RAW socket. Return =3D %d\n",nRet=
urn);
> + return 0;
See earlier review.
> }
> =20
> =20
> void rt_packet_proto_release(void)
> {
> rtdm_dev_unregister(&packet_proto_dev, 1000);
> + rtdm_dev_unregister(&raw_packet_proto_dev, 1000);
> }
> =20
> =20
Jan
|