netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: bryan.wu@analog.com
Cc: jgarzik@pobox.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH -mm 3/5] Blackfin: on-chip ethernet MAC controller driver
Date: Thu, 1 Mar 2007 00:53:15 -0800	[thread overview]
Message-ID: <20070301005315.3a37c960.akpm@linux-foundation.org> (raw)
In-Reply-To: <1172722514.5264.77.camel@roc-desktop>

On Thu, 01 Mar 2007 12:15:14 +0800 "Wu, Bryan" <bryan.wu@analog.com> wrote:

> Hi folks,
> 
> Here is the blackfin on-chip ethernet MAC controller driver for Linux.
> 
> It's name is blackfin-driver-net-stamp537.patch
> 
> [PATCH] Blackfin: on-chip ethernet MAC controller driver
> 
> This patch implements the driver necessary use the Analog Devices
> Blackfin processor's on-chip ethernet MAC controller.
> 
> ...
>
> +
> +extern void get_bf537_ether_addr(char *addr);

Please don't put extern declarations in .c code.  Put them in a header file
which is included by the file which provides the definition and by all
files which refer to the symbol.

Please review the entire blackfin patchset for more occurrences of this
mistake.

> +static int bf537mac_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
> +{
> +	struct bf537mac_local *lp = netdev_priv(dev);
> +	unsigned int data;
> +
> +	current_tx_ptr->skb = skb;
> +	// Is skb->data always 16-bit aligned? Do we need to memcpy((char *)(tail->packet + 2),skb->data,len)?
> +	if ((((unsigned int)(skb->data)) & 0x02) == 2) {
> +		//move skb->data to current_tx_ptr payload
> +		data = (unsigned int)(skb->data) - 2;
> +		*((unsigned short *)data) = (unsigned short)(skb->len);
> +		current_tx_ptr->desc_a.start_addr = (unsigned long)data;
> +		blackfin_dcache_flush_range(data, (data + (skb->len)) + 2);	//this is important!
> +
> +	} else {
> +		*((unsigned short *)(current_tx_ptr->packet)) =
> +		    (unsigned short)(skb->len);
> +		memcpy((char *)(current_tx_ptr->packet + 2), skb->data,
> +		       (skb->len));
> +		current_tx_ptr->desc_a.start_addr =
> +		    (unsigned long)current_tx_ptr->packet;
> +		if (current_tx_ptr->status.status_word != 0)
> +			current_tx_ptr->status.status_word = 0;
> +		blackfin_dcache_flush_range((unsigned int)current_tx_ptr->
> +					    packet,
> +					    (unsigned int)(current_tx_ptr->
> +							   packet + skb->len) +
> +					    2);
> +	}

hm, I'd have thought that networking provided a way of avoiding that
memcpy, but it has been too long..


> +	current_tx_ptr->desc_a.config.b_DMA_EN = 1;	//enable this packet's dma
> +
> +	if (bfin_read_DMA2_IRQ_STATUS() & 0x08) {	//tx dma is running, just return
> +		goto out;
> +	} else {		//tx dma is not running
> +		bfin_write_DMA2_NEXT_DESC_PTR(&(current_tx_ptr->desc_a));
> +		bfin_write_DMA2_CONFIG(*((unsigned short *)(&(current_tx_ptr->desc_a.config))));	// dma enabled, read from memory, size is 6
> +		// Turn on the EMAC tx
> +		bfin_write_EMAC_OPMODE(bfin_read_EMAC_OPMODE() | TE);
> +	}
> +
> +      out:
> +	adjust_tx_list();
> +	current_tx_ptr = current_tx_ptr->next;
> +	dev->trans_start = jiffies;
> +	lp->stats.tx_packets++;
> +	lp->stats.tx_bytes += (skb->len);
> +	return 0;
> +}


  reply	other threads:[~2007-03-01  8:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-01  4:15 [PATCH -mm 3/5] Blackfin: on-chip ethernet MAC controller driver Wu, Bryan
2007-03-01  8:53 ` Andrew Morton [this message]
2007-03-01 15:52 ` Stephen Hemminger
2007-03-01 18:21   ` Mike Frysinger
2007-03-01 18:35   ` Robin Getz
2007-03-02  8:08   ` Wu, Bryan

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=20070301005315.3a37c960.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=bryan.wu@analog.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --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).