All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] xenomai-3/next: modprobe rtpacket fails with -EINVAL
@ 2015-02-05 11:15 Anders Blomdell
  2015-02-05 11:50 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 4+ messages in thread
From: Anders Blomdell @ 2015-02-05 11:15 UTC (permalink / raw)
  To: Xenomai@xenomai.org

AFAICT there are two ways to fix it, either change kernel/cobalt/rtdm/device.c:

       if (drv->device_count <= 0)
                return -EINVAL;
to:
       if (drv->device_count <= 0 ||
	   (drv->device_count == 0 && 
	    (drv->device_flags & RTDM_DEVICE_TYPE_MASK) != RTDM_PROTOCOL_DEVICE)))
                return -EINVAL;    

or change kernel/drivers/net/stack/packet/af_packet.c:

  static struct rtdm_driver packet_proto_drv = {
    .profile_info =     RTDM_PROFILE_INFO(packet,
                                        RTDM_CLASS_NETWORK,
                                        RTDM_SUBCLASS_RTNET,
                                        RTNET_RTDM_VER),
    .device_flags =     RTDM_PROTOCOL_DEVICE,
    .context_size =     sizeof(struct rtsocket),
    ...
  }

to:

  static struct rtdm_driver packet_proto_drv = {
    .profile_info =     RTDM_PROFILE_INFO(packet,
                                        RTDM_CLASS_NETWORK,
                                        RTDM_SUBCLASS_RTNET,
                                        RTNET_RTDM_VER),
    .device_flags =     RTDM_PROTOCOL_DEVICE,
    .device_count =     1,
    .context_size =     sizeof(struct rtsocket),
    ...
  }

Since the second change is what 'rtdm_driver raw_packet_proto_drv', and the code looks
prettier, I guess that the second way is the preferred one?

/Anders
-- 
Anders Blomdell                  Email: anders.blomdell@control.lth.se
Department of Automatic Control
Lund University                  Phone:    +46 46 222 4625
P.O. Box 118                     Fax:      +46 46 138118
SE-221 00 Lund, Sweden



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai] xenomai-3/next: modprobe rtpacket fails with -EINVAL
  2015-02-05 11:15 [Xenomai] xenomai-3/next: modprobe rtpacket fails with -EINVAL Anders Blomdell
@ 2015-02-05 11:50 ` Gilles Chanteperdrix
  2015-02-05 13:59   ` Anders Blomdell
  0 siblings, 1 reply; 4+ messages in thread
From: Gilles Chanteperdrix @ 2015-02-05 11:50 UTC (permalink / raw)
  To: Anders Blomdell; +Cc: Xenomai@xenomai.org

On Thu, Feb 05, 2015 at 12:15:22PM +0100, Anders Blomdell wrote:
> AFAICT there are two ways to fix it, either change kernel/cobalt/rtdm/device.c:
> 
>        if (drv->device_count <= 0)
>                 return -EINVAL;
> to:
>        if (drv->device_count <= 0 ||
> 	   (drv->device_count == 0 && 
> 	    (drv->device_flags & RTDM_DEVICE_TYPE_MASK) != RTDM_PROTOCOL_DEVICE)))
>                 return -EINVAL;    
> 
> or change kernel/drivers/net/stack/packet/af_packet.c:
> 
>   static struct rtdm_driver packet_proto_drv = {
>     .profile_info =     RTDM_PROFILE_INFO(packet,
>                                         RTDM_CLASS_NETWORK,
>                                         RTDM_SUBCLASS_RTNET,
>                                         RTNET_RTDM_VER),
>     .device_flags =     RTDM_PROTOCOL_DEVICE,
>     .context_size =     sizeof(struct rtsocket),
>     ...
>   }
> 
> to:
> 
>   static struct rtdm_driver packet_proto_drv = {
>     .profile_info =     RTDM_PROFILE_INFO(packet,
>                                         RTDM_CLASS_NETWORK,
>                                         RTDM_SUBCLASS_RTNET,
>                                         RTNET_RTDM_VER),
>     .device_flags =     RTDM_PROTOCOL_DEVICE,
>     .device_count =     1,
>     .context_size =     sizeof(struct rtsocket),
>     ...
>   }
> 
> Since the second change is what 'rtdm_driver raw_packet_proto_drv', and the code looks
> prettier, I guess that the second way is the preferred one?

I received a patch for this issue, I simply need to merge it. Thanks
for the reminder.

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai] xenomai-3/next: modprobe rtpacket fails with -EINVAL
  2015-02-05 11:50 ` Gilles Chanteperdrix
@ 2015-02-05 13:59   ` Anders Blomdell
  2015-02-05 14:03     ` Gilles Chanteperdrix
  0 siblings, 1 reply; 4+ messages in thread
From: Anders Blomdell @ 2015-02-05 13:59 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai@xenomai.org

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2015-02-05 12:50, Gilles Chanteperdrix wrote:
> I received a patch for this issue, I simply need to merge it. Thanks
> for the reminder.

OK, ".device_count =     1," works for me now. 

BTW: is it the expected behaviour that when rtpacket is not loaded, socket()
will default to __real_socket()?

/Anders


- -- 
Anders Blomdell                  Email: anders.blomdell@control.lth.se
Department of Automatic Control
Lund University                  Phone:    +46 46 222 4625
P.O. Box 118                     Fax:      +46 46 138118
SE-221 00 Lund, Sweden

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJU03c3AAoJENZYyvaDG8NcdOIH/1KOtrLaXGVOz/UR6qCTHH4w
DXiEcVaYyZfsxWFYGlaYLJX4eEyaDyUgwwzxu9btZK20C380GJvXBujNQRo/fCzT
y/lM/4mDzuWqUpdSWhEfklVM9W90pSB1nUO2FpxTtNdVYJRGrZa5MhltobrmyZKw
WXIVU9Hs47d1WevvXRbHMM1WFHh6kMcbmjYzJ596B2zAFs1qRQjQb/QaxhlCITbq
5enzxCaqXQTC1saBCcNKhg+dLviGOqUVIHJvr5PRSp+nRgTP5QKqcXbu3p0NxSf/
mHViajS7f/muPbCFFOvAytiF/bRb5qXcnqpKybpWkSihozy7vMA7GVh+Dc3BAi4=
=5r/d
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai] xenomai-3/next: modprobe rtpacket fails with -EINVAL
  2015-02-05 13:59   ` Anders Blomdell
@ 2015-02-05 14:03     ` Gilles Chanteperdrix
  0 siblings, 0 replies; 4+ messages in thread
From: Gilles Chanteperdrix @ 2015-02-05 14:03 UTC (permalink / raw)
  To: Anders Blomdell; +Cc: Xenomai@xenomai.org

On Thu, Feb 05, 2015 at 02:59:21PM +0100, Anders Blomdell wrote:
> On 2015-02-05 12:50, Gilles Chanteperdrix wrote:
> > I received a patch for this issue, I simply need to merge it. Thanks
> > for the reminder.
> 
> OK, ".device_count =     1," works for me now. 
> 
> BTW: is it the expected behaviour that when rtpacket is not loaded, socket()
> will default to __real_socket()?

Well, it depends on the parameters you pass to socket. I guess it
only happens if you want to create a raw packet socket.

-- 
					    Gilles.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: not available
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20150205/03d01172/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-05 14:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-05 11:15 [Xenomai] xenomai-3/next: modprobe rtpacket fails with -EINVAL Anders Blomdell
2015-02-05 11:50 ` Gilles Chanteperdrix
2015-02-05 13:59   ` Anders Blomdell
2015-02-05 14:03     ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.