[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121203194151.GA5324@netboy.at.omicron.at>
Date: Mon, 3 Dec 2012 20:41:51 +0100
From: Richard Cochran <richardcochran@...il.com>
To: Michael Chan <mchan@...adcom.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, nsujir@...adcom.com
Subject: Re: [PATCH 3/4 net-next] tg3: PTP - Add the hardware timestamp
ioctl
On Sun, Dec 02, 2012 at 07:42:50PM -0800, Michael Chan wrote:
> From: Matt Carlson <mcarlson@...adcom.com>
>
> This patch implements the SIOCSHWTSTAMP ioctl as described in
> Documentation/networking/timestamping.txt
>
> Signed-off-by: Nithin Nayak Sujir <nsujir@...adcom.com>
> Signed-off-by: Michael Chan <mchan@...adcom.com>
> ---
> drivers/net/ethernet/broadcom/tg3.c | 99 +++++++++++++++++++++++++++++++++++
> 1 files changed, 99 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index a54d194..f6e956c 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -12755,6 +12755,102 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
>
> }
>
> +static int tg3_hwtstamp_ioctl(struct net_device *dev,
> + struct ifreq *ifr, int cmd)
> +{
> + struct tg3 *tp = netdev_priv(dev);
> + struct hwtstamp_config stmpconf;
> +
> + if (!tg3_flag(tp, PTP_CAPABLE))
> + return -EINVAL;
> +
> + if (copy_from_user(&stmpconf, ifr->ifr_data, sizeof(stmpconf)))
> + return -EFAULT;
> +
> + if (stmpconf.flags)
> + return -EINVAL;
> +
> + switch (stmpconf.tx_type) {
> + case HWTSTAMP_TX_ON:
> + tg3_flag_set(tp, TX_TSTAMP_EN);
> + break;
> + case HWTSTAMP_TX_OFF:
> + tg3_flag_clear(tp, TX_TSTAMP_EN);
> + break;
> + default:
> + return -ERANGE;
> + }
> +
> + switch (stmpconf.rx_filter) {
> + case HWTSTAMP_FILTER_NONE:
> + tp->rxptpctl = 0;
> + break;
> + case HWTSTAMP_FILTER_ALL:
This filter code means that all packets are stamped, not just all PTP
packets. I guess that you should return ERANGE here.
Thanks,
Richard
--
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