From: Flavio Leitner <fbl@redhat.com>
To: linuxptp-devel@lists.sourceforge.net
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 3/3] e1000e: PTP: provide hardware features
Date: Wed, 30 Oct 2013 19:50:34 -0200 [thread overview]
Message-ID: <20131030215034.GA13373@plex.lan> (raw)
In-Reply-To: <1383159637-8165-4-git-send-email-fbl@redhat.com>
Adding CC to netdev.
The first patch [1/3] is the userlevel linuxptp patch, so
I am not forwarding to netdev.
This is just an example which I used for testing locally. If
the idea is acceptable, this patch must be replaced since the
card does support more features than what is listed below.
fbl
On Wed, Oct 30, 2013 at 05:00:37PM -0200, Flavio Leitner wrote:
> Provide the modes and transports supported by the hardware.
>
> Signed-off-by: Flavio Leitner <fbl@redhat.com>
> ---
> drivers/net/ethernet/intel/e1000e/netdev.c | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index 4ef7867..8bcf167 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -3498,10 +3498,6 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter)
> if (!(adapter->flags & FLAG_HAS_HW_TIMESTAMP))
> return -EINVAL;
>
> - /* flags reserved for future extensions - must be zero */
> - if (config->flags)
> - return -EINVAL;
> -
> switch (config->tx_type) {
> case HWTSTAMP_TX_OFF:
> tsync_tx_ctl = 0;
> @@ -5772,6 +5768,9 @@ static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
> return 0;
> }
>
> +#define E1000E_HWSTAMP_FLAGS_MASK (HWTSTAMP_DM_E2E | HWTSTAMP_DM_P2P |\
> + HWTSTAMP_TRANS_IEEE_802_3 |\
> + HWTSTAMP_TRANS_UDP_IPV4)
> /**
> * e1000e_hwtstamp_ioctl - control hardware time stamping
> * @netdev: network interface device structure
> @@ -5792,11 +5791,23 @@ static int e1000e_hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr)
> {
> struct e1000_adapter *adapter = netdev_priv(netdev);
> struct hwtstamp_config config;
> + int flags_req;
> + int flags_unsup;
> int ret_val;
>
> if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
> return -EFAULT;
>
> + if (config.flags & ~HWTSTAMP_FEATURE_FLAGS_MASK)
> + return -EINVAL;
> +
> + flags_req = config.flags & HWTSTAMP_FEATURE_FLAGS_MASK;
> + flags_unsup = flags_req & ~E1000E_HWSTAMP_FLAGS_MASK;
> + if (flags_unsup) {
> + config.flags &= ~flags_unsup;
> + goto out;
> + }
> +
> adapter->hwtstamp_config = config;
>
> ret_val = e1000e_config_hwtstamp(adapter);
> @@ -5823,6 +5834,7 @@ static int e1000e_hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr)
> break;
> }
>
> +out:
> return copy_to_user(ifr->ifr_data, &config,
> sizeof(config)) ? -EFAULT : 0;
> }
> --
> 1.8.3.1
>
prev parent reply other threads:[~2013-10-30 22:39 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 ` RFC [PATCH 2/3] PTP: use flags to request HW features Flavio Leitner
2013-10-31 7:12 ` [Linuxptp-devel] " 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 ` Flavio Leitner [this message]
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=20131030215034.GA13373@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).