lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1330927473.3140.1.camel@joe2Laptop>
Date:	Sun, 04 Mar 2012 22:04:33 -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 until timeout 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 necessary 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 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

Powered by Openwall GNU/*/Linux Powered by OpenVZ