public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Kristoffer Glembo <kristoffer@gaisler•com>
To: Ben Hutchings <bhutchings@solarflare•com>
Cc: netdev@vger•kernel.org
Subject: Re: [PATCH 1/1] net: Add Aeroflex Gaisler GRETH 10/100/1G Ethernet MAC driver
Date: Mon, 11 Jan 2010 17:21:14 +0100	[thread overview]
Message-ID: <4B4B4FFA.8070805@gaisler.com> (raw)
In-Reply-To: <1262991459.17358.63.camel@achroite.uk.solarflarecom.com>

Hi Ben,

Thanks for the feedback.

Ben Hutchings wrote:
> On Fri, 2010-01-08 at 16:45 +0100, Kristoffer Glembo wrote:
> [...]
>> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
>> index dd9a09c..806c127 100644
>> --- a/drivers/net/Kconfig
>> +++ b/drivers/net/Kconfig
> 
> This is just about the worst possible way to configure the MAC address.
> You should be getting it from EEPROM/flash or OpenFirmware properties.

Yes sorry for that ugliness. I will change this to OF properties.

> Is this driver really so good that we should configure it twice?
> 

Maybe not :) .. but I wanted it to show up both in 10/100 and
1000 Mbps since it supports two different devices. But I read in
Kconfig now that it then should be only in 10/100. That's fine.


> [...] 
>> diff --git a/drivers/net/greth.c b/drivers/net/greth.c

>> +#define GRETH_REGLOAD(a)	    (__raw_readl(&(a)))
>> +#define GRETH_REGSAVE(a, v)         (__raw_writel(v, &(a)))
>> +#define GRETH_REGORIN(a, v)         (GRETH_REGSAVE(a, (GRETH_REGLOAD(a) | (v))))
>> +#define GRETH_REGANDIN(a, v)        (GRETH_REGSAVE(a, (GRETH_REGLOAD(a) & (v))))
> 
> I think you need an mmiowb() after the __raw_writel().
> Also, are you sure the registers are going to match host byte order?


I'm working on a CPU with strong ordering so I'm not so confident in these matters,
but as I understand it I should in that case not put mmiowb() after each __raw_writel()
but only before unlocks where mmio has been done in the critical section.

I have not put a single explicit memory barrier in the code, I was under the 
impression that each architecture that needs it has it in the __raw_writel. 
I only used the __raw versions since I wanted native byte ordering. I should add
cpu_to_be32 and be32_to_cpu however as you point out. Questions is do I need to add
wmb/mb when I use __raw as well?


 
> Use print_hex_dump().
> 

Ah nice, thanks!


>> +
>> +			pr_debug(" %.2x", *((unsigned char *)
>> +					    (phys_to_virt
>> +					     (skb_shinfo(skb)->frags[i].page) +
>> +					     skb_shinfo(skb)->frags[i].page_offset + j)));
> 
> WTF?  phys_to_virt() does not work on pointers to struct page.

Oops. Some untested code crept in here. Adding page_to_phys.


I will fix the other issues you mentioned and resend the patch.


Best regards,
Kristoffer Glembo


  reply	other threads:[~2010-01-11 16:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-08 15:45 [PATCH 0/1] net: Add Aeroflex Gaisler GRETH 10/100/1G Ethernet MAC driver Kristoffer Glembo
2010-01-08 15:45 ` [PATCH 1/1] " Kristoffer Glembo
2010-01-08 22:57   ` Ben Hutchings
2010-01-11 16:21     ` Kristoffer Glembo [this message]
2010-01-11 17:34       ` Ben Hutchings

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=4B4B4FFA.8070805@gaisler.com \
    --to=kristoffer@gaisler$(echo .)com \
    --cc=bhutchings@solarflare$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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