Skip to contentSkip to conversation

tsec: Configure the buffer descriptor bases to always include all of the descriptors

PATCH New Joe Hershberger 6 participants 12 messages Aug 10, 2011 – Aug 24, 2011 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tsec: Configure the buffer descriptor bases to always include all of the descriptors

Previously only the last N were included based on the current one in use.

Cc Joe Hershberger <[email protected]>
Cc Mingkai Hu <[email protected]>
Cc Andy Fleming <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Detlev Zundel <[email protected]>
---
 drivers/net/tsec.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/tsec.c +2 -2
index 78ffc95..1805ca0 100644
@@ -250,8 +250,8 @@ static void startup_tsec(struct eth_device *dev)
 	txIdx = 0;
 
 	/* Point to the buffer descriptors */
-	out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[txIdx]));
-	out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[rxIdx]));
+	out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[0]));
+	out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[0]));
 
 	/* Initialize the Rx Buffer descriptors */
 	for (i = 0; i < PKTBUFSRX; i++) {
Signature · 1 line
1.6.0.2
#1 lore raw

PATCH 1/1 tsec: Configure the buffer descriptor bases to always include all of the descriptors

Hi Joe,

Quoted 17 lines

Previously only the last N were included based on the current one in use.

Cc Joe Hershberger <[email protected]>
Cc Mingkai Hu <[email protected]>
Cc Andy Fleming <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Detlev Zundel <[email protected]>
---
 drivers/net/tsec.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/tsec.c +0 -0
index 78ffc95..1805ca0 100644

drivers/net/tsec.c static void startup_tsec(struct eth_device *dev) · line 257

Quoted 10 lines
drivers/net/tsec.c +2 -2
@@ -250,8 +250,8 @@ static void startup_tsec(struct eth_device *dev)
 	txIdx = 0;
 
 	/* Point to the buffer descriptors */
-	out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[txIdx]));
-	out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[rxIdx]));
+	out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[0]));
+	out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[0]));
 
 	/* Initialize the Rx Buffer descriptors */
 	for (i = 0; i < PKTBUFSRX; i++) {

I see these two lines just before the code you change (one is even in the context of your patch):

        /* reset the indices to zero */
        rxIdx = 0;
        txIdx = 0;

So can you tell me, what your change actually does? I cannot remember that we have concurrency issues here, or do we?

Cheers
Detlev

Signature · 7 lines
Don't trust everything you read, and don't assume every poster in
a thread is actually relevant to the problem.
        -- Stefan Monnier <[email protected]>
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#2 lore raw

PATCH 1/1 tsec: Configure the buffer descriptor bases to always include all of the descriptors

Quoted 19 lines · Detlev Zundel
Quoted 13 lines
drivers/net/tsec.c +0 -0
index 78ffc95..1805ca0 100644
@@ -250,8 +250,8 @@ static void startup_tsec(struct eth_device *dev)
 ? ? ? txIdx = 0;
 

? ? ? /* Point to the buffer descriptors */
- ? ? out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[txIdx]));
- ? ? out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[rxIdx]));
+ ? ? out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[0]));
+ ? ? out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[0]));

Quoted 2 lines

? ? ? /* Initialize the Rx Buffer descriptors */
? ? ? for (i = 0; i < PKTBUFSRX; i++) {

I see these two lines just before the code you change (one is even in the context of your patch):

Quoted 6 lines

? ? ? ?/* reset the indices to zero */
? ? ? ?rxIdx = 0;
? ? ? ?txIdx = 0;

So can you tell me, what your change actually does? ?I cannot remember that we have concurrency issues here, or do we?

My apologies... I ported this patch from my work in u-boot 2009.11 and did not notice that change above. I think explicitly using 0 when assigning the base address pointers is clearer, though.

It seems the resetting of the indexes to 0 was added by Andy Fleming in 063c12633d5ad74d52152d9c358e715475e17629, though the log doesn't discuss it..

Best regards,
-Joe

#3 lore raw

PATCH 1/1 tsec: Configure the buffer descriptor bases to always include all of the descriptors

Hi Joe,

Quoted 27 lines · Detlev Zundel
Quoted 19 lines
Quoted 13 lines
drivers/net/tsec.c +0 -0
index 78ffc95..1805ca0 100644
@@ -250,8 +250,8 @@ static void startup_tsec(struct eth_device *dev)
 ? ? ? txIdx = 0;
 

? ? ? /* Point to the buffer descriptors */
- ? ? out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[txIdx]));
- ? ? out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[rxIdx]));
+ ? ? out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[0]));
+ ? ? out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[0]));

Quoted 2 lines

? ? ? /* Initialize the Rx Buffer descriptors */
? ? ? for (i = 0; i < PKTBUFSRX; i++) {

I see these two lines just before the code you change (one is even in the context of your patch):

Quoted 6 lines

? ? ? ?/* reset the indices to zero */
? ? ? ?rxIdx = 0;
? ? ? ?txIdx = 0;

So can you tell me, what your change actually does? ?I cannot remember that we have concurrency issues here, or do we?

Quoted 7 lines

My apologies... I ported this patch from my work in u-boot 2009.11 and did not notice that change above. I think explicitly using 0 when assigning the base address pointers is clearer, though.

It seems the resetting of the indexes to 0 was added by Andy Fleming in 063c12633d5ad74d52152d9c358e715475e17629, though the log doesn't discuss it..

Yes, I see - it even slipped my review :( For the patch as such I don't have a preference - looking at the code both ways really read the same for me.

Cheers
Detlev

Signature · 9 lines
I've never understood the tendency to pick up tastes because they are popular.
In fact,  I think it is  foolish to do that.  I mean, don't  you know what you
like?  People who  are so weak that  they will take  their tastes  from people
around  them  in  the  desperate  desire  to be  accepted,  I think of them as
cowards.               -- Richard M. Stallman
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#4 lore raw

PATCH 1/1 tsec: Configure the buffer descriptor bases to always include all of the descriptors

Quoted 33 lines · Detlev Zundel

Hi Joe,

Quoted 31 lines · Detlev Zundel
Quoted 19 lines
Quoted 5 lines
drivers/net/tsec.c +0 -0
index 78ffc95..1805ca0 100644

drivers/net/tsec.c static void startup_tsec(struct eth_device *dev) · line 257

Quoted 10 lines
drivers/net/tsec.c +2 -2
@@ -250,8 +250,8 @@ static void startup_tsec(struct eth_device *dev)
      txIdx = 0;
 
      /* Point to the buffer descriptors */
-     out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[txIdx]));
-     out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[rxIdx]));
+     out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[0]));
+     out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[0]));
 
      /* Initialize the Rx Buffer descriptors */
      for (i = 0; i < PKTBUFSRX; i++) {

I see these two lines just before the code you change (one is even in the context of your patch):

Quoted 6 lines
       /* reset the indices to zero */
       rxIdx = 0;
       txIdx = 0;

So can you tell me, what your change actually does? I cannot remember that we have concurrency issues here, or do we?

My apologies... I ported this patch from my work in u-boot 2009.11 and did not notice that change above. I think explicitly using 0 when assigning the base address pointers is clearer, though.

Quoted 7 lines
Quoted 3 lines

It seems the resetting of the indexes to 0 was added by Andy Fleming in 063c12633d5ad74d52152d9c358e715475e17629, though the log doesn't discuss it..

Yes, I see - it even slipped my review :( For the patch as such I don't have a preference - looking at the code both ways really read the same for me.

Well, it wasn't added in that patch, exactly. What really happened is I accidentally applied two patches, and then had to break them up again. That part accidentally got put in the second patch. A careful review of the patch history indicates that the indices have always been zeroed out beforehand (though sometimes in separate functions).

All the same, it looks like this patch is a good idea, to me.

Andy

#5 lore raw

PATCH 1/1 tsec: Configure the buffer descriptor bases to always include all of the descriptors

Hi Andy,

[...]

Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

It seems the resetting of the indexes to 0 was added by Andy Fleming in 063c12633d5ad74d52152d9c358e715475e17629, though the log doesn't discuss it..

Yes, I see - it even slipped my review :( For the patch as such I don't have a preference - looking at the code both ways really read the same for me.

Quoted 5 lines

Well, it wasn't added in that patch, exactly. What really happened is I accidentally applied two patches, and then had to break them up again. That part accidentally got put in the second patch. A careful review of the patch history indicates that the indices have always been zeroed out beforehand (though sometimes in separate functions).

It slipped my review nevertheless.

Quoted 1 line

All the same, it looks like this patch is a good idea, to me.

Then submit an acked-by which should help the patch along.

Cheers
Detlev

Signature · 9 lines
F?r jemanden, der in eine Religion geboren wurde, in der das Ringen um eine
einzige Seele ein Stafettenlauf ?ber viele Jahrhunderte sein kann [..], hat
das Tempo des Christentums etwas Schwindelerregendes.   Wenn der Hinduismus
friedlich dahinflie?t wie der Ganges,  dann ist das  Christentum Toronto in
der Rushhour.                        -- Yann Martel
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#6 lore raw

PATCH 1/1 tsec: Configure the buffer descriptor bases to always include all of the descriptors

In reply to Joe Hershberger
Quoted 8 lines · Joe Hershberger

Previously only the last N were included based on the current one in use.

Cc Joe Hershberger <[email protected]>
Cc Mingkai Hu <[email protected]>
Cc Andy Fleming <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Detlev Zundel <[email protected]>

I'm curious if you were seeing a problem that this fixes?

Quoted 9 lines

---
drivers/net/tsec.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/tsec.c +0 -0
index 78ffc95..1805ca0 100644

drivers/net/tsec.c static void startup_tsec(struct eth_device *dev) · line 254

Quoted 7 lines
drivers/net/tsec.c +2 -2
@@ -250,8 +250,8 @@ static void startup_tsec(struct eth_device *dev)
 	txIdx = 0;
 
 	/* Point to the buffer descriptors */
-	out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[txIdx]));
-	out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[rxIdx]));
+	out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[0]));
+	out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[0]));

However, while I don't believe this fixes a technical problem, I believe this makes the code more straightforward.

So if this is a fix to a problem, we need more information to understand what you're really fixing. If this is just fixing something that looked wrong...:

#7 lore raw

PATCH 1/1 tsec: Configure the buffer descriptor bases to always include all of the descriptors

Quoted 13 lines · Andy Fleming
Quoted 8 lines · Joe Hershberger

Previously only the last N were included based on the current one in use.

Cc Joe Hershberger <[email protected]>
Cc Mingkai Hu <[email protected]>
Cc Andy Fleming <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Detlev Zundel <[email protected]>
Quoted 1 line

I'm curious if you were seeing a problem that this fixes?

I was searching for a performance problem on the MPC8313, and discovered this, which seemed wrong. It was not, however, the source of my problem.

Quoted 11 lines
Quoted 11 lines

---
drivers/net/tsec.c | ? ?4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/tsec.c +0 -0
index 78ffc95..1805ca0 100644
@@ -250,8 +250,8 @@ static void startup_tsec(struct eth_device *dev)
 ? ? ? txIdx = 0;
 
Quoted 7 lines
Quoted 5 lines

? ? ? /* Point to the buffer descriptors */
- ? ? out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[txIdx]));
- ? ? out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[rxIdx]));
+ ? ? out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[0]));
+ ? ? out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[0]));

However, while I don't believe this fixes a technical problem, I believe this makes the code more straightforward.

I agree. It is more straightforward to use 0 explicitly.

Quoted 3 lines

So if this is a fix to a problem, we need more information to understand what you're really fixing. If this is just fixing something that looked wrong...:

It fixes something that was wrong before you committed 063c12633d5ad74d52152d9c358e715475e17629, but at this point, it's just cosmetic.

Best regards,
-Joe

#8 lore raw

PATCH 1/1 tsec: Configure the buffer descriptor bases to always include all of the descriptors

Dear Joe Hershberger,

Quoted 4 lines · In message <CANr=Z=aNQtW_YV-XcqsE8f2RPDpYYMhKL7WWSrcPa_pqZKj8uw@mail.gmail.com>…

It fixes something that was wrong before you committed 063c12633d5ad74d52152d9c358e715475e17629, but at this point, it's just cosmetic.

I don't think this is worth to change the code. Can you accept that we drop this patch?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If I have seen further it is by standing on the shoulders of  giants.
              - Isaac Newton, Letter to Robert Hooke, 5 February 1676
#9 lore raw

PATCH 1/1 tsec: Configure the buffer descriptor bases to always include all of the descriptors

Quoted 10 lines · Wolfgang Denk

Dear Joe Hershberger,

Quoted 4 lines · In message <CANr=Z=aNQtW_YV-XcqsE8f2RPDpYYMhKL7WWSrcPa_pqZKj8uw@mail.gmail.com>…

It fixes something that was wrong before you committed 063c12633d5ad74d52152d9c358e715475e17629, but at this point, it's just cosmetic.

I don't think this is worth to change the code. ?Can you accept that we drop this patch?

Yes, it is fine to drop this patch.

-Joe

#10 lore raw

PATCH 1/1 tsec: Configure the buffer descriptor bases to always include all of the descriptors

In reply to Joe Hershberger
Quoted 8 lines · Joe Hershberger

Previously only the last N were included based on the current one in use.

Cc Joe Hershberger <[email protected]>
Cc Mingkai Hu <[email protected]>
Cc Andy Fleming <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Detlev Zundel <[email protected]>
#11 lore raw

PATCH 1/1 tsec: Configure the buffer descriptor bases to always include all of the descriptors

In reply to Joe Hershberger

Hello.

Quoted 17 lines · Joe Hershberger

Previously only the last N were included based on the current one in use.

Cc Joe Hershberger<[email protected]>
Cc Mingkai Hu<[email protected]>
Cc Andy Fleming<[email protected]>
Cc Kumar Gala<[email protected]>
Cc Detlev Zundel<[email protected]>
---
  drivers/net/tsec.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/tsec.c +0 -0
index 78ffc95..1805ca0 100644

drivers/net/tsec.c static void startup_tsec(struct eth_device *dev) · line 254

Quoted 7 lines
drivers/net/tsec.c +2 -2
@@ -250,8 +250,8 @@ static void startup_tsec(struct eth_device *dev)
  	txIdx = 0;
 
  	/* Point to the buffer descriptors */
-	out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[txIdx]));
-	out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[rxIdx]));
+	out_be32(&regs->tbase, (unsigned int)(&rtx.txbd[0]));
+	out_be32(&regs->rbase, (unsigned int)(&rtx.rxbd[0]));

Note that & and [0] are not really needed.

WBR, Sergei