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: <20140318001921.GA18556@electric-eye.fr.zoreil.com>
Date:	Tue, 18 Mar 2014 01:19:21 +0100
From:	Francois Romieu <romieu@...zoreil.com>
To:	Vince Bridgers <vbridgers2013@...il.com>
Cc:	devicetree@...r.kernel.org, netdev@...r.kernel.org,
	linux-doc@...r.kernel.org, robh+dt@...nel.org, pawel.moll@....com,
	mark.rutland@....com, ijc+devicetree@...lion.org.uk,
	galak@...eaurora.org, rob@...dley.net
Subject: Re: [PATCH net-next V6 6/9] Altera TSE: Add main and header file for
 Altera Ethernet Driver

Vince Bridgers <vbridgers2013@...il.com> :
[...]
> diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
> new file mode 100644
> index 0000000..6006ef2
> --- /dev/null
> +++ b/drivers/net/ethernet/altera/altera_tse_main.c
[...]
> +static int tse_tx_complete(struct altera_tse_private *priv)
> +{
> +	unsigned int txsize = priv->tx_ring_size;
> +	u32 ready;
> +	unsigned int entry;
> +	struct tse_buffer *tx_buff;
> +	int txcomplete = 0;
> +
> +	spin_lock(&priv->tx_lock);
> +
> +	ready = priv->dmaops->tx_completions(priv);
> +
> +	/* Free sent buffers */
> +	while (ready && (priv->tx_cons != priv->tx_prod)) {
> +		entry = priv->tx_cons % txsize;
> +		tx_buff = &priv->tx_ring[entry];
> +
> +		if (netif_msg_tx_done(priv))
> +			netdev_dbg(priv->dev, "%s: curr %d, dirty %d\n",
> +				   __func__, priv->tx_prod, priv->tx_cons);
> +
> +		if (likely(tx_buff->skb))
> +			priv->dev->stats.tx_packets++;
> +
> +		tse_free_tx_buffer(priv, tx_buff);
> +		priv->tx_cons++;
> +
> +		txcomplete++;
> +		ready--;
> +	}
> +
> +	if (unlikely(netif_queue_stopped(priv->dev) &&
> +		     tse_tx_avail(priv) > TSE_TX_THRESH(priv))) {
> +		netif_tx_lock(priv->dev);

This code runs under device tx_lock. You don't need both and you should
be able to avoid tx_lock completely. See drivers/net/ethernet/broadcom/tg3.c
for instance.

[...]
> +static int tse_start_xmit(struct sk_buff *skb, struct net_device *dev)
> +{
> +	struct altera_tse_private *priv = netdev_priv(dev);
> +	unsigned int txsize = priv->tx_ring_size;
> +	unsigned int entry;
> +	struct tse_buffer *buffer = NULL;
> +	int nfrags = skb_shinfo(skb)->nr_frags;
> +	unsigned int nopaged_len = skb_headlen(skb);
> +	enum netdev_tx ret = NETDEV_TX_OK;
> +	dma_addr_t dma_addr;
> +	int txcomplete = 0;
> +
> +	spin_lock_bh(&priv->tx_lock);

See above.

Nit: start_xmit runs with locally disabled softirq. _bh wouldn't be
needed anyway.

-- 
Ueimor
--
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