> But then struct pbuf is still only 16 bytes long, so payload might
> start in the middle of a 32-byte border, which leads to faults when
> flushing cache (since the struct pbuf members are still used cached) or
> am I wrong there?

I don't have the problem, because:
1. I don't need to align my payload. I just need to ensure that a cache line 
cannot contain payload of pbuf N and struct of pbuf N+1.
I do this by setting (PBUF_POOL_BUFSIZE + sizeof(struct pbuf)) = multiple of 
cache line size

2. on RX, the pbuf is owned by the driver so I can safely flush the cache to 
get the payload, because I know the stack will not modify a value in the struct.

> > But I agree it could be easier with something like:
> > #define PBUF_ALIGNMENT      32
> 
> That's what I imagined (only with another name maybe).

Ok, maybe we need 2 settings:
1. alignement of pbuf struct
2. alignement of pbuf payload (may lead to wasted memory)

-- 
Stéphane Lesage



_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to