All of lore.kernel.org
 help / color / mirror / Atom feed
From: Flavio Leitner <fbl@redhat.com>
To: linuxptp-devel@lists.sourceforge.net
Cc: netdev@vger.kernel.org
Subject: Re: RFC [PATCH 2/3] PTP: use flags to request HW features
Date: Wed, 30 Oct 2013 19:48:41 -0200	[thread overview]
Message-ID: <20131030214841.GZ13373@plex.lan> (raw)
In-Reply-To: <1383159637-8165-3-git-send-email-fbl@redhat.com>

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@redhat.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
> 

       reply	other threads:[~2013-10-30 21:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1383159637-8165-1-git-send-email-fbl@redhat.com>
     [not found] ` <1383159637-8165-3-git-send-email-fbl@redhat.com>
2013-10-30 21:48   ` Flavio Leitner [this message]
2013-10-31  7:12     ` [Linuxptp-devel] RFC [PATCH 2/3] PTP: use flags to request HW features Richard Cochran
2013-11-01  1:34       ` Flavio Leitner
     [not found] ` <1383159637-8165-4-git-send-email-fbl@redhat.com>
2013-10-30 21:50   ` [PATCH 3/3] e1000e: PTP: provide hardware features Flavio Leitner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131030214841.GZ13373@plex.lan \
    --to=fbl@redhat.com \
    --cc=linuxptp-devel@lists.sourceforge.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.