Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1330419
| From | "Karicheri, Muralidharan" <m-karicheri2@ti.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | RE: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality |
| Date | 2016-02-09 17:20 +0100 |
| Message-ID | <r0jbe-6vm-29@gated-at.bofh.it> (permalink) |
| References | <r0gZK-4N6-41@gated-at.bofh.it> <r0hj3-59v-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
>-----Original Message-----
>From: David Laight [mailto:David.Laight@ACULAB.COM]
>Sent: Tuesday, February 09, 2016 9:13 AM
>To: Strashko, Grygorii; netdev@vger.kernel.org; David S . Miller; Arnd Bergmann
>Cc: Cooper Jr., Franklin; Nori, Sekhar; linux-kernel@vger.kernel.org; Kwok, WingMan;
>Karicheri, Muralidharan; N, Mugunthan V
>Subject: RE: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality
>
>From: Grygorii Strashko
>> Sent: 09 February 2016 13:58
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> The commit 899077791403 ("netcp: try to reduce type confusion in
>> descriptors") introduces a regression in Kernel 4.5-rc1 and it breaks
>> get/set_pad_info() functionality.
>>
>> The TI NETCP driver uses pad0 and pad1 fields of knav_dma_desc to
>> store DMA/MEM buffer pointer and buffer size respectively. And in both
>> cases for Keystone 2 the pointer type size is 32 bit regardless of
>> LAPE enabled or not, because CONFIG_ARCH_DMA_ADDR_T_64BIT originally
>> is not expected to be defined.
>>
>> !LAPE LPAE
>> sizeof(void*) 32bit 32bit
>> sizeof(dma_addr_t) 32bit 32bit
>> sizeof(phys_addr_t) 32bit 64bit
>>
>> Unfortunately, above commit changed buffer's pointers save/restore
>> code (get/set_pad_info()) and added intermediate conversation to u64
>> which works incorrectly on 32bit Keystone 2 and causes TI NETCP driver
>> crash in RX/TX path due to "Unable to handle kernel NULL pointer"
>> exception. This issue was reported and discussed in [1].
>>
>> Hence, fix it by partially reverting above commit and restoring
>> get/set_pad_info() functionality as it was before.
>
>You should really get rid of most of the horrid pointer-integer casts.
>Code like:
>> void *buf_ptr;
>...
>> + get_pad_info((u32 *)&buf_ptr, &buf_len, ndesc);
>is just asking for trouble.
>
>You'd be better using assignments like:
> buf_ptr = (cast)get_pad_0(ndesc);
> buf_len = get_pad_1(ndesc);
>Then the values are passed (and cast) as numerics.
>
>In reality the 'pad' fields ought to be renamed - since they aren't pads.
>Perhaps they should be a union?
No. At the end of the descriptor, host software can add scratchpad which is
not modified by the hardware, but is used by the driver. So please don't
rename.
Murali
>
> David
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] net: ti: netcp: restore get/set_pad_info() functionality Grygorii Strashko <grygorii.strashko@ti.com> - 2016-02-09 15:00 +0100
RE: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality David Laight <David.Laight@ACULAB.COM> - 2016-02-09 15:20 +0100
RE: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality "Karicheri, Muralidharan" <m-karicheri2@ti.com> - 2016-02-09 17:20 +0100
RE: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality "Karicheri, Muralidharan" <m-karicheri2@ti.com> - 2016-02-09 17:20 +0100
RE: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality David Laight <David.Laight@ACULAB.COM> - 2016-02-09 17:50 +0100
RE: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality "Karicheri, Muralidharan" <m-karicheri2@ti.com> - 2016-02-09 18:00 +0100
Re: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality Arnd Bergmann <arnd@arndb.de> - 2016-02-09 20:40 +0100
Re: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality Grygorii Strashko <grygorii.strashko@ti.com> - 2016-02-10 09:40 +0100
Re: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality Murali Karicheri <m-karicheri2@ti.com> - 2016-02-17 17:30 +0100
Re: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality Murali Karicheri <m-karicheri2@ti.com> - 2016-02-18 18:10 +0100
RE: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality David Laight <David.Laight@ACULAB.COM> - 2016-02-09 17:20 +0100
Re: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality David Miller <davem@davemloft.net> - 2016-02-16 21:30 +0100
Re: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality Murali Karicheri <m-karicheri2@ti.com> - 2016-02-18 18:20 +0100
Re: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality David Miller <davem@davemloft.net> - 2016-02-18 21:10 +0100
csiph-web