[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131030214841.GZ13373@plex.lan>
Date: Wed, 30 Oct 2013 19:48:41 -0200
From: Flavio Leitner <fbl@...hat.com>
To: linuxptp-devel@...ts.sourceforge.net
Cc: netdev@...r.kernel.org
Subject: Re: RFC [PATCH 2/3] PTP: use flags to request HW features
Adding CC to netdev.
On Wed, Oct 30, 2013 at 05:00:36PM -0200, Flavio Leitner wrote:
> Currently the user space can't tell which delay mechanism
> (E2E/P2P) or transport is needed in the ioctl(). Therefore,
> PTP silently fails when the hardware doesn't support a
> certain delay mechanism or transport.
>
> This patch uses the ioctl flags field to pass that information
> from the user space to kernel. If the hardware supports all
> the desired features, the ioctl continues as before, otherwise
> the unsupported bits are reseted to 0 and this information is
> returned to user space.
>
> It's backwards compatible. If an older PTP applications calls
> the ioctl(), the flags field will be zero and no feature is
> checked.
>
> Signed-off-by: Flavio Leitner <fbl@...hat.com>
> ---
> include/uapi/linux/net_tstamp.h | 21 +++++++++++++++++++++
> net/core/dev_ioctl.c | 3 ---
> 2 files changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/include/uapi/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h
> index ae5df12..d63f8e9 100644
> --- a/include/uapi/linux/net_tstamp.h
> +++ b/include/uapi/linux/net_tstamp.h
> @@ -44,6 +44,27 @@ struct hwtstamp_config {
> int rx_filter;
> };
>
> +/* possible values for hwtstamp_config->flags */
> +#define HWTSTAMP_FEATURE_FLAGS_MASK 0xFFFF
> +enum hwtstamp_feature_flags {
> + /* End-to-End Delay Mechanism */
> + HWTSTAMP_DM_E2E = (1<<0),
> + /* Peer-to-Peer Delay Mechanism */
> + HWTSTAMP_DM_P2P = (1<<1),
> + /* hole: 3 bits for additional mechanisms */
> +
> + HWTSTAMP_TRANS_UDS = (1<<5),
> + /* Message Transport: UDP over IPv4 */
> + HWTSTAMP_TRANS_UDP_IPV4 = (1<<6),
> + /* Message Transport: UDP over IPv6 */
> + HWTSTAMP_TRANS_UDP_IPV6 = (1<<7),
> + /* Message Transport: IEEE 802.3 Ethernet */
> + HWTSTAMP_TRANS_IEEE_802_3 = (1<<8),
> + HWTSTAMP_TRANS_DEVICENET = (1<<9),
> + HWTSTAMP_TRANS_CONTROLNET = (1<<10),
> + HWTSTAMP_TRANS_PROFINET = (1<<11),
> +};
> +
> /* possible values for hwtstamp_config->tx_type */
> enum hwtstamp_tx_types {
> /*
> diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
> index 5b7d0e1..9e2407e 100644
> --- a/net/core/dev_ioctl.c
> +++ b/net/core/dev_ioctl.c
> @@ -193,9 +193,6 @@ static int net_hwtstamp_validate(struct ifreq *ifr)
> if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)))
> return -EFAULT;
>
> - if (cfg.flags) /* reserved for future extensions */
> - return -EINVAL;
> -
> tx_type = cfg.tx_type;
> rx_filter = cfg.rx_filter;
>
> --
> 1.8.3.1
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists