public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Mugunthan V N <mugunthanvnm@ti.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: net: Add TI DaVinci EMAC driver
Date: Wed, 21 Aug 2013 09:33:50 +0000	[thread overview]
Message-ID: <5214D6D1.8080705@ti.com> (raw)
In-Reply-To: <20130821084024.GK5240@elgon.mountain>

On Wednesday 21 August 2013 02:56 PM, Dan Carpenter wrote:
> On Wed, Aug 21, 2013 at 08:11:10PM +0530, Mugunthan V N wrote:
>> On Wednesday 21 August 2013 02:14 PM, Gole, Anant wrote:
>>> drivers/net/ethernet/ti/davinci_emac.c
>>>   1316                   ((EMAC_DEF_ERROR_FRAME_EN) ? (EMAC_RXMBP_CEFEN_MASK) : 0x0) |
>>>   1317                   ((EMAC_DEF_PROM_EN) ? (EMAC_RXMBP_CAFEN_MASK) : 0x0) |
>>>   1318                   ((EMAC_DEF_PROM_CH & EMAC_RXMBP_CHMASK) << \
>>>                            ^^^^^^^^^^^^^^^^ This is bit 0 but it's used as a mask.  It should maybe be:
>>>
>>> 				EMAC_MBP_PROMISCCH(EMAC_DEF_PROM_CH) & EMAC_RXMBP_CHMASK
>> EMAC_DEF_PROM_CH is not denoting bit 0 but denoting which DMA channel to
>> be used to transfer promiscuous packet (i.e other MAC packets which
>> doesn't belong to us) from EMAC to DDR.
>>
>> The existing code is correct but it can be simplified as you have
>> mentioned here to make code review simpler. Will prepare a patch and
>> submit to mailing list soon.
> Let me say this a different way "(0 & x) is always zero".  We can
> just delete it because we know:
>
> 	((EMAC_DEF_PROM_CH & EMAC_RXMBP_CHMASK) << \
> 		EMAC_RXMBP_PROMCH_SHIFT)
>
> We know that 0 ANDed and then shifted is still zero.
>
>
Lets take channel 1 (i.e. channel 1 for promiscuous packet) as example
which will make it more clear. 1 & 7 will be 1, & 7 is to make a upper
limit and not to choose any channel greater than 7 and now 1 << 16 makes
sense. Since in current driver we choose channel 0 for promiscuous
packet so it looks like it makes no sense.

So when some one wants to use channel 1 to 7, then the above code will
make a difference in DMA performance.

Regards
Mugunthan V N

  parent reply	other threads:[~2013-08-21  9:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-21  8:40 net: Add TI DaVinci EMAC driver Dan Carpenter
2013-08-21  8:44 ` Gole, Anant
2013-08-21  9:11 ` Mugunthan V N
2013-08-21  9:26 ` Dan Carpenter
2013-08-21  9:33 ` Mugunthan V N [this message]
2013-08-21 10:07 ` Dan Carpenter

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=5214D6D1.8080705@ti.com \
    --to=mugunthanvnm@ti.com \
    --cc=kernel-janitors@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