Re: [U-Boot] NetRxPackets

2011-01-19 Thread Vitaly Kuzmichev
Hi Marcel,

Marcel wrote:
>> Not sure that branch is anything up to date
>
> hmmm.  What branch is best to work on for this code ?

If someone sends USB-CDC patches they usually are applied into master
branch of u-boot-usb.git repository:
http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot/u-boot-usb.git;a=summary

AFAIK, master branch of u-boot main repository is also working well, but
I haven't checked whether all recent patches are pulled into main
repository.
If you are using another version of u-boot (one of the previous
releases) the driver in your version may be broken.

According to the log from "Usage of DMA" thread I think your gadget
stack is up to date.

> req->buf = (u8 *) NetRxPackets[0];
>>
>> *maybe* "req" itself is not allocated?
> 
> Good question. My code that rejects the buffer is this :
> 
> [...]
> if (!_req || !_req->complete
> || !_req->buf || !list_empty(&req->queue)) {
>   
> DBG("invalid request\n");
> if(!_req) debug("NO REQUEST\n");
> if(!_req->complete) debug("NO REQUEST COMPLETE\n");
> if(!_req->buf) debug("NO REQUEST BUF\n");
> if(!list_empty(&req->queue)) debug("NO LIST EMPTY\n");
> return -EINVAL;
> }
> 
> It just keeps failing with "NO REQUEST BUF". I feel like I'm staring at a 
> typo 
> for days and just don't see it.

I suppose that usage of kzalloc in usba_ep_alloc_request (if you haven't
changed it) may be not well. at91_udc driver (for example) uses static
pool for requests allocation.

Anyway it's strange. I have a suspicion that buf was set to NULL
somewhere inside atmel_usba_udc.



With best regards,
Vitaly.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] NetRxPackets

2011-01-18 Thread Marcel
On Tuesday, January 18, 2011 11:53:38 pm Wolfgang Denk wrote:
> Dear Marcel,
> 
> In message <201101182337.32274.korg...@home.nl> you wrote:
> > > Hint: have a look at "net/net.c".
> > 
> > I found that, but it doesn't make sense to me. I'll read it again and
> > hopefully it makes sense to me than. Anyway, my knowledge of the ethernet
> > part in u-boot is limited and I do not focus on ethernet. I will not use
> > ether.c in the end anyway and I was just hoping it would work as a basis
> > to test my new controller code.
> > 
> > > And note: as NetRxPackets[] is a static array I can't see how
> > > NetRxPackets[0] should be a "non existing buffer".
> > 
> > Well, I guess the point where that's done doesn't show up nicely with
> > grep.
> 
> Come on.  You will find a static array declaration when you know the
> exact name of the file and the variable, right?

Well finding it is not the issue. I can't find a reason why it wouldn't work.

Regards,
Marcel
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] NetRxPackets

2011-01-18 Thread Marcel
On Tuesday, January 18, 2011 11:54:22 pm Reinhard Meyer wrote:
> Dear Marcel,
> 
> >> Well,you're supposed to do some basic code reading yourself.
> > 
> > Of course. It's always the idea to post a question after reading for some
> > time. It either means I don't understand the code, the code really
> > doesn't work or I did miss the most important part in the documents. I
> > guess the answer will follow once the issue is solved.
> > To be specific, I work with the u-boot-usb at91-cdc branch code. I'm not
> > sure if that is all working code at this moment but sounded like the
> > best starting point for my USB code.
> 
> Not sure that branch is anything up to date

hmmm.  What branch is best to work on for this code ?
 
> >>> req->buf = (u8 *) NetRxPackets[0];
> 
> *maybe* "req" itself is not allocated?

Good question. My code that rejects the buffer is this :

static int
usba_ep_queue(struct usb_ep *_ep, 
  struct usb_request *_req, 
  gfp_t gfp_flags)
{
struct usba_request *req = container_of(_req, struct usba_request, 
req);
struct usba_ep *ep = container_of(_ep, struct usba_ep, ep);
struct usba_udc *udc = ep->udc;
int ret;

debug("%s: queue req %p, len %u\n",
ep->ep.name, req, _req->length);
  
if (!_req || !_req->complete
|| !_req->buf || !list_empty(&req->queue)) {
  
DBG("invalid request\n");
if(!_req) debug("NO REQUEST\n");
if(!_req->complete) debug("NO REQUEST COMPLETE\n");
if(!_req->buf) debug("NO REQUEST BUF\n");
if(!list_empty(&req->queue)) debug("NO LIST EMPTY\n");
return -EINVAL;
}

It just keeps failing with "NO REQUEST BUF". I feel like I'm staring at a typo 
for days and just don't see it.

regards,
Marcel


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] NetRxPackets

2011-01-18 Thread Wolfgang Denk
Dear Marcel,

In message <201101182337.32274.korg...@home.nl> you wrote:
> 
> > Hint: have a look at "net/net.c".
> 
> I found that, but it doesn't make sense to me. I'll read it again and 
> hopefully it makes sense to me than. Anyway, my knowledge of the ethernet 
> part 
> in u-boot is limited and I do not focus on ethernet. I will not use ether.c 
> in 
> the end anyway and I was just hoping it would work as a basis to test my new 
> controller code. 
> 
> > And note: as NetRxPackets[] is a static array I can't see how
> > NetRxPackets[0] should be a "non existing buffer".
> 
> Well, I guess the point where that's done doesn't show up nicely with grep.

Come on.  You will find a static array declaration when you know the
exact name of the file and the variable, right?



Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
Status quo. Latin for "the mess we're in."
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] NetRxPackets

2011-01-18 Thread Reinhard Meyer
Dear Marcel,
>> Well,you're supposed to do some basic code reading yourself.
>
> Of course. It's always the idea to post a question after reading for some
> time. It either means I don't understand the code, the code really doesn't
> work or I did miss the most important part in the documents. I guess the
> answer will follow once the issue is solved.
> To be specific, I work with the u-boot-usb at91-cdc branch code. I'm not sure
> if that is all working code at this moment but sounded like the best starting
> point for my USB code.

Not sure that branch is anything up to date

>
>>> req->buf = (u8 *) NetRxPackets[0];

*maybe* "req" itself is not allocated?

Best Regards,
Reinhard
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] NetRxPackets

2011-01-18 Thread Marcel
Hi Wolfgang,

> > Nobody ?
> 
> Well,you're supposed to do some basic code reading yourself.

Of course. It's always the idea to post a question after reading for some 
time. It either means I don't understand the code, the code really doesn't 
work or I did miss the most important part in the documents. I guess the 
answer will follow once the issue is solved.
To be specific, I work with the u-boot-usb at91-cdc branch code. I'm not sure 
if that is all working code at this moment but sounded like the best starting 
point for my USB code.
 
> > req->buf = (u8 *) NetRxPackets[0];
> > 
> > This is returning an non existing buffer for some reason and I know not
> > much about the ethernet layer to fix this.
> 
> But you know how to use the search function in your favorite editor,
> and tools like for example ctags or grep?
> 
> Hint: have a look at "net/net.c".

I found that, but it doesn't make sense to me. I'll read it again and 
hopefully it makes sense to me than. Anyway, my knowledge of the ethernet part 
in u-boot is limited and I do not focus on ethernet. I will not use ether.c in 
the end anyway and I was just hoping it would work as a basis to test my new 
controller code. 

> And note: as NetRxPackets[] is a static array I can't see how
> NetRxPackets[0] should be a "non existing buffer".

Well, I guess the point where that's done doesn't show up nicely with grep.
I probably missed it and will start to read the ethernet code. I know little 
of the ethernet code so I feel that as of tomorrow I will skip ether.c and 
move on to implementing another driver for testing my controller code.

My feeling is that I miss something very simple, but I can be looking for it 
for days. Perhaps I missed some define or whatever, but I'm almost certain that 
I missed something extremely simple that causes NetRxPackets to be empty 
somehow.

regards,
Marcel



___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] NetRxPackets

2011-01-18 Thread Wolfgang Denk
Dear Marcel,

In message <201101182208.33651.korg...@home.nl> you wrote:
>
> > Anyone have an idea how NetRxPackets is allocated ?
> 
> Nobody ?

Well,you're supposed to do some basic code reading yourself.

> req->buf = (u8 *) NetRxPackets[0];
> 
> This is returning an non existing buffer for some reason and I know not much 
> about the ethernet layer to fix this. 

But you know how to use the search function in your favorite editor,
and tools like for example ctags or grep?

Hint: have a look at "net/net.c".

And note: as NetRxPackets[] is a static array I can't see how
NetRxPackets[0] should be a "non existing buffer".

Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
In C we had to code our own bugs, in C++ we can inherit them.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] NetRxPackets

2011-01-18 Thread Marcel
On Tuesday, January 18, 2011 01:15:25 am Marcel wrote:
> Hi,
> 
> ether.c contains the following code :
> 
>  req->buf = (u8 *) NetRxPackets[0];
> req->length = size;
> req->complete = rx_complete;
> 
> retval = usb_ep_queue(dev->out_ep, req, gfp_flags);
> 
> 
> My USB controller code that I'm writing responds that req->buf is NULL. So
> the OUT packets don't get processed.
> I know OUT data arrives in my controller code as I can read it, so my OUT
> endpoint is working. Also my status endpoint is working correctly and my
> guess is there's nothing wrong with my controller code.
> 
> Anyone have an idea how NetRxPackets is allocated ?

Nobody ?

req->buf = (u8 *) NetRxPackets[0];

This is returning an non existing buffer for some reason and I know not much 
about the ethernet layer to fix this. 
My guess is I miss some define (eth related) somewhere but I'm also about to 
give up on ether.c and just port a more simple driver to u-boot for testing 
USB device controller drivers.  

Any ideas why this could happen or how I can find out why that is ?

Best regards,
Marcel


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot