xenomai-3/next: modprobe rtpacket fails with -EINVAL
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
Signature · 5 lines
Anders Blomdell Email: [email protected] Department of Automatic Control Lund University Phone: +46 46 222 4625 P.O. Box 118 Fax: +46 46 138118 SE-221 00 Lund, Sweden
Quoted 35 lines · Anders Blomdell
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), ... }
Quoted 2 lines
Since the second change is what '
rtdm_driverraw_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.
Signature · 1 line
Gilles.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 2 lines · Gilles Chanteperdrix
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: [email protected]
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-----
Quoted 8 lines · Anders Blomdell
Quoted 2 lines · Gilles Chanteperdrix
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.
Signature · 8 lines
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>