[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1330927336.3009.10.camel@joe2Laptop>
Date: Sun, 04 Mar 2012 22:02:16 -0800
From: Joe Perches <joe@...ches.com>
To: Takahiro Shimizu <tshimizu818@...il.com>
Cc: jeffrey.t.kirsher@...el.com, davem@...emloft.net,
lucas.demarchi@...fusion.mobi, mirq-linux@...e.qmqm.pl,
paul.gortmaker@...driver.com, toshiharu-linux@....okisemi.com,
jdmason@...zu.us, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, qi.wang@...el.com,
yong.y.wang@...el.com, joel.clark@...el.com, kok.howg.ewe@...el.com
Subject: Re: [PATCH] net/pch_gbe: supports eg20t ptp clock
On Mon, 2012-03-05 at 14:46 +0900, Takahiro Shimizu wrote:
> From: Takahiroi Shimizu <tshimizu818@...il.com>
> Supports EG20T ptp clock in the driver
just some trivial comments...
> diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> +/* 0x40 Time Synchronization Channel Control Register Bits */
> +#define MASTER_MODE (1<<0)
> +#define SLAVE_MODE (0<<0)
> +#define V2_MODE (1<<31)
> +#define CAP_MODE0 (0<<16)
0 << anything is pretty ugly.
[]
> +static void pch_rx_timestamp(
> + struct pch_gbe_adapter *adapter, struct sk_buff *skb)
Also not too pretty.
Maybe
static void
pch_rx_timestamp(struct pch_gbe_adapter *adapter, struct sk_buff *skb)
[]
> +static void pch_tx_timestamp(
> + struct pch_gbe_adapter *adapter, struct sk_buff *skb)
here too.
[]
> + shtx = skb_shinfo(skb);
> + if (unlikely(shtx->tx_flags & SKBTX_HW_TSTAMP && adapter->hwts_tx_en))
> + shtx->tx_flags |= SKBTX_IN_PROGRESS;
> + else
> + return;
probably better as
if (likely(!(shtx->tx_flags & SKBTX_HW_TSTAMP &&
adapter->hwts_tx_en)))
return;
shtx->tx_flags |= etc...
> +
> + /* Get ieee1588's dev information */
> + pdev = adapter->ptp_pdev;
> +
> + /*
> + * This really stinks, but we have to poll for the Tx time stamp.
> + * Usually, the time stamp is ready after 4 to 6 microseconds.
> + */
> + for (cnt = 0; cnt < 100; cnt++) {
> + val = pch_ch_event_read(pdev);
> + if (val & TX_SNAPSHOT_LOCKED)
> + break;
> + udelay(1);
> + }
why not just continually poll instead of udelay?
[]
> +static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
[]
> + switch (cfg.rx_filter) {
> + case HWTSTAMP_FILTER_NONE:
> + adapter->hwts_rx_en = 0;
> + break;
> + case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
> + adapter->hwts_rx_en = 0;
> + pch_ch_control_write(pdev, (SLAVE_MODE | CAP_MODE0));
parentheses are not nececessary around SLAVE_MODE | CAP_MODE0
> + break;
> + case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
> + adapter->hwts_rx_en = 1;
> + pch_ch_control_write(pdev, (MASTER_MODE | CAP_MODE0));
here too.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists