linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC] net: mvneta: 64bit platform support
@ 2016-03-30 13:37 Jisheng Zhang
  2016-03-30 13:45 ` Jisheng Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Jisheng Zhang @ 2016-03-30 13:37 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

Obviously, current mvneta driver can't work on 64bit platforms. For one thing
the BM feature should be explicitly disabled, I just sent out one patch for
this purpose. 

What's more, the buf_cookie in mvneta_rx_desc need to be carefully considered.
The driver use the buf_cookie(u32 type) to store the buffer virtual address,
obviously it can't store the virtual address on 64bit platforms. I have two
solutions:

solution A: let one reserved type in current mvneta_rx_desc, e.g reserved5
to store the high 32bit virt address, and hack code as the following:
#ifdef CONFIG_64BIT
rx_desc->reserved5 = high32(data);
#endif

solution B: add one member void **buf_virt_ptrs in mvneta_rx_queue, and point
all buf_cookie usage to the according buf_virt_ptrs[i]


Is there any elegant solutions?

Thanks,
Jisheng

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [RFC] net: mvneta: 64bit platform support
  2016-03-30 13:37 [RFC] net: mvneta: 64bit platform support Jisheng Zhang
@ 2016-03-30 13:45 ` Jisheng Zhang
  2016-03-30 13:55   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Jisheng Zhang @ 2016-03-30 13:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 30 Mar 2016 21:37:00 +0800 Jisheng Zhang wrote:

> Hi all,
> 
> Obviously, current mvneta driver can't work on 64bit platforms. For one thing
> the BM feature should be explicitly disabled, I just sent out one patch for
> this purpose. 
> 
> What's more, the buf_cookie in mvneta_rx_desc need to be carefully considered.
> The driver use the buf_cookie(u32 type) to store the buffer virtual address,
> obviously it can't store the virtual address on 64bit platforms. I have two
> solutions:
> 
> solution A: let one reserved type in current mvneta_rx_desc, e.g reserved5
> to store the high 32bit virt address, and hack code as the following:
> #ifdef CONFIG_64BIT
> rx_desc->reserved5 = high32(data);
> #endif

oh, missing some code:
#ifdef CONFIG_64BIT
data = ((u64)rx_desc->reserved5 << 32) | rx_desc->buf_cookie;
#else
data = (void*)rx_desc->buf_cookie;
#endif

> 
> solution B: add one member void **buf_virt_ptrs in mvneta_rx_queue, and point
> all buf_cookie usage to the according buf_virt_ptrs[i]
> 
> 
> Is there any elegant solutions?
> 
> Thanks,
> Jisheng
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [RFC] net: mvneta: 64bit platform support
  2016-03-30 13:45 ` Jisheng Zhang
@ 2016-03-30 13:55   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-03-30 13:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 30 March 2016 21:45:35 Jisheng Zhang wrote:
> oh, missing some code:
> #ifdef CONFIG_64BIT
> data = ((u64)rx_desc->reserved5 << 32) | rx_desc->buf_cookie;
> #else
> data = (void*)rx_desc->buf_cookie;
> #endif
> 
> 

Please use the upper_32_bits() and lower_32_bits() macros to split
up the pointer into two halves, and use the 64-bit version of the
code above unconditionally, that should both work on all architectures
without introducing any overhead.

	Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-30 13:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-30 13:37 [RFC] net: mvneta: 64bit platform support Jisheng Zhang
2016-03-30 13:45 ` Jisheng Zhang
2016-03-30 13:55   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).