Add ifreq pointer field to kernel_hwtstamp_config structure
Subsystems (3)
RFC PATCH v4 2/5 Add ifreq pointer field to kernel_hwtstamp_config structure
Considering the stackable nature of drivers there will be situations where a driver implementing ndo_hwtstamp_get/set functions will have to translate requests back to SIOCGHWTSTAMP/SIOCSHWTSTAMP IOCTLs to pass them to lower level drivers that do not provide ndo_hwtstamp_get/set callbacks. To simplify request translation in such scenarios let's include a pointer to the original struct ifreq to kernel_hwtstamp_config structure.
Notes:
Changes in V4:
- Introducing KERNEL_HWTSTAMP_FLAG_IFR_RESULT flag indicating that the operation results are returned in the ifr referred by struct kernel_hwtstamp_config instead of kernel_hwtstamp_config glags/tx_type/rx_filter fields.
- Implementing generic_hwtstamp_set/set_lower() functions which will be used by vlan, maxvlan, bond and potentially other drivers translating ndo_hwtstamp_set/set calls to lower level drivers.
--- include/linux/net_tstamp.h | 7 ++++ include/linux/netdevice.h | 6 +++ net/core/dev_ioctl.c | 80 +++++++++++++++++++++++++++++++++++--- 3 files changed, 87 insertions(+), 6 deletions(-)
include/linux/net_tstamp.h +7 -0
@@ -20,6 +20,13 @@ struct kernel_hwtstamp_config {int flags;int tx_type;int rx_filter; +struct ifreq *ifr; +int kernel_flags; +}; + +/* possible values for kernel_hwtstamp_config->kernel_flags */ +enum kernel_hwtstamp_flags { +KERNEL_HWTSTAMP_FLAG_IFR_RESULT = (1 <<0 ), }; static inline void hwtstamp_config_to_kernel(struct kernel_hwtstamp_config *kernel_cfg,
include/linux/netdevice.h +6 -0
@@ -3939,6 +3939,12 @@ int put_user_ifreq(struct ifreq *ifr, void __user *arg);int dev_ioctl (struct net *net,unsigned int cmd,struct ifreq *ifr,void __user *data,bool *need_copyout);int dev_ifconf (struct net *net,struct ifconf __user *ifc); +int generic_hwtstamp_set_lower (struct net_device *dev, +struct kernel_hwtstamp_config *kernel_cfg, +struct netlink_ext_ack *extack); +int generic_hwtstamp_get_lower (struct net_device *dev, +struct kernel_hwtstamp_config *kernel_cfg, +struct netlink_ext_ack *extack);int dev_ethtool (struct net *net,struct ifreq *ifr,void __user *userdata);unsigned int dev_get_flags (const struct net_device *); int __dev_change_flags(struct net_device *dev, unsigned int flags,
net/core/dev_ioctl.c +74 -6
108 lines not on this page · raw message
Signature · 1 line
2.39.2
Quoted 33 lines · Maxim Georgiev
Considering the stackable nature of drivers there will be situations where a driver implementing ndo_hwtstamp_get/set functions will have to translate requests back to SIOCGHWTSTAMP/SIOCSHWTSTAMP IOCTLs to pass them to lower level drivers that do not provide ndo_hwtstamp_get/set callbacks. To simplify request translation in such scenarios let's include a pointer to the original struct ifreq to
kernel_hwtstamp_configstructure.Suggested-by Jakub Kicinski <[email protected]>Signed-off-by Maxim Georgiev <[email protected]>Notes:
Changes in V4:
- IntroducingKERNEL_HWTSTAMP_FLAG_IFR_RESULTflag indicating that the operation results are returned in the ifr referred by structkernel_hwtstamp_configinstead ofkernel_hwtstamp_configglags/tx_type/rx_filter fields.
- Implementing generic_hwtstamp_set/set_lower() functions which will be used by vlan, maxvlan, bond and potentially other drivers translating ndo_hwtstamp_set/set calls to lower level drivers.--- include/linux/net_tstamp.h | 7 ++++ include/linux/netdevice.h | 6 +++ net/core/dev_ioctl.c | 80 +++++++++++++++++++++++++++++++++++--- 3 files changed, 87 insertions(+), 6 deletions(-)include/linux/net_tstamp.h +0
-0
include/linux/net_tstamp.h struct kernel_hwtstamp_config { · line 24
Quoted 5 lines
include/linux/net_tstamp.h +2
-0@@ -20,6 +20,13 @@ struct kernel_hwtstamp_config {int flags;int tx_type;int rx_filter; +struct ifreq *ifr; +int kernel_flags;
nit: ifr and kernel_flags should be added to the kdoc for this struct
that appears immediately above it.
include/linux/net_tstamp.h struct kernel_hwtstamp_config { · line 29
Quoted 5 lines
include/linux/net_tstamp.h +5
-0+}; + +/* possible values for kernel_hwtstamp_config->kernel_flags */ +enum kernel_hwtstamp_flags { +KERNEL_HWTSTAMP_FLAG_IFR_RESULT = (1 <<0 ),
nit: maybe BIT(0)
Quoted 3 lines
include/linux/net_tstamp.h +0
-0}; static inline void hwtstamp_config_to_kernel(struct kernel_hwtstamp_config *kernel_cfg,
...
Quoted 52 lines · Simon Horman
Quoted 33 lines · Maxim Georgiev
Considering the stackable nature of drivers there will be situations where a driver implementing ndo_hwtstamp_get/set functions will have to translate requests back to SIOCGHWTSTAMP/SIOCSHWTSTAMP IOCTLs to pass them to lower level drivers that do not provide ndo_hwtstamp_get/set callbacks. To simplify request translation in such scenarios let's include a pointer to the original struct ifreq to
kernel_hwtstamp_configstructure.Suggested-by Jakub Kicinski <[email protected]>Signed-off-by Maxim Georgiev <[email protected]>Notes:
Changes in V4:
- IntroducingKERNEL_HWTSTAMP_FLAG_IFR_RESULTflag indicating that the operation results are returned in the ifr referred by structkernel_hwtstamp_configinstead ofkernel_hwtstamp_configglags/tx_type/rx_filter fields.
- Implementing generic_hwtstamp_set/set_lower() functions which will be used by vlan, maxvlan, bond and potentially other drivers translating ndo_hwtstamp_set/set calls to lower level drivers.--- include/linux/net_tstamp.h | 7 ++++ include/linux/netdevice.h | 6 +++ net/core/dev_ioctl.c | 80 +++++++++++++++++++++++++++++++++++--- 3 files changed, 87 insertions(+), 6 deletions(-)include/linux/net_tstamp.h +0
-0include/linux/net_tstamp.h struct kernel_hwtstamp_config { · line 24
Quoted 5 lines
include/linux/net_tstamp.h +2
-0@@ -20,6 +20,13 @@ struct kernel_hwtstamp_config {int flags;int tx_type;int rx_filter; +struct ifreq *ifr; +int kernel_flags;nit: ifr and
kernel_flagsshould be added to the kdoc for this struct
that appears immediately above it.include/linux/net_tstamp.h struct kernel_hwtstamp_config { · line 29
Quoted 5 lines
include/linux/net_tstamp.h +5
-0+}; + +/* possible values for kernel_hwtstamp_config->kernel_flags */ +enum kernel_hwtstamp_flags { +KERNEL_HWTSTAMP_FLAG_IFR_RESULT = (1 <<0 ),nit: maybe BIT(0)
Quoted 5 lines
Quoted 3 lines
include/linux/net_tstamp.h +0
-0}; static inline void hwtstamp_config_to_kernel(struct kernel_hwtstamp_config *kernel_cfg,...
Thank you for the feedback!
I'll update and resend the patch