net/netdev: Add CONFIG_NETDEV_CAN_FILTER_IOCTL

This commit is contained in:
JacobCrabill
2022-04-15 14:40:00 -07:00
committed by Mateusz Szafoni
parent 5f82c82e4d
commit 4610aee973
6 changed files with 99 additions and 36 deletions
+9
View File
@@ -24,6 +24,15 @@ config NETDEV_CAN_BITRATE_IOCTL
---help---
Enable support for ioctl() commands to change CAN bitrate
config NETDEV_CAN_FILTER_IOCTL
bool "Enable CAN filter ioctl()"
default n
select NETDEV_IOCTL
depends on NET_CAN
---help---
Enable support for ioctl() commands to add/remove CAN hardware-level
filters (NOTE: Not supported by all drivers)
config NETDEV_WIRELESS_IOCTL
bool "Enable Wireless ioctl()"
default n
+19 -1
View File
@@ -1072,7 +1072,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
if (dev && dev->d_ioctl)
{
struct can_ioctl_data_s *can_bitrate_data =
&req->ifr_ifru.ifru_can_data;
&req->ifr_ifru.ifru_can_data;
ret = dev->d_ioctl(dev, cmd,
(unsigned long)(uintptr_t)can_bitrate_data);
}
@@ -1080,6 +1080,24 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
break;
#endif
#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NETDEV_CAN_FILTER_IOCTL)
case SIOCACANEXTFILTER: /* Add an extended-ID filter */
case SIOCDCANEXTFILTER: /* Delete an extended-ID filter */
case SIOCACANSTDFILTER: /* Add a standard-ID filter */
case SIOCDCANSTDFILTER: /* Delete a standard-ID filter */
{
dev = netdev_ifr_dev(req);
if (dev && dev->d_ioctl)
{
struct can_ioctl_filter_s *can_filter =
&req->ifr_ifru.ifru_can_filter;
ret = dev->d_ioctl(dev, cmd,
(unsigned long)(uintptr_t)can_filter);
}
}
break;
#endif
#ifdef CONFIG_NETDEV_IFINDEX
case SIOCGIFNAME: /* Get interface name */
{