From: David Laight <David.Laight@ACULAB.COM>
To: "'Grygorii Strashko'" <grygorii.strashko@ti.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"David S . Miller" <davem@davemloft.net>,
"Arnd Bergmann" <arnd@arndb.de>
Cc: Franklin S Cooper Jr <fcooper@ti.com>,
Sekhar Nori <nsekhar@ti.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Wingman Kwok <w-kwok2@ti.com>,
Murali Karicheri <m-karicheri2@ti.com>,
Mugunthan V N <mugunthanvnm@ti.com>
Subject: RE: [PATCH] net: ti: netcp: restore get/set_pad_info() functionality
Date: Tue, 9 Feb 2016 14:13:04 +0000 [thread overview]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CCDBFCC@AcuExch.aculab.com> (raw)
In-Reply-To: <1455026303-17014-1-git-send-email-grygorii.strashko@ti.com>
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?
David
next prev parent reply other threads:[~2016-02-09 14:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-09 13:58 Grygorii Strashko
2016-02-09 14:13 ` David Laight [this message]
2016-02-09 16:09 ` Karicheri, Muralidharan
2016-02-09 16:10 ` David Laight
2016-02-09 16:19 ` Karicheri, Muralidharan
2016-02-09 16:37 ` David Laight
2016-02-09 16:55 ` Karicheri, Muralidharan
2016-02-09 19:38 ` Arnd Bergmann
2016-02-10 8:33 ` Grygorii Strashko
2016-02-17 16:19 ` Murali Karicheri
2016-02-18 17:02 ` Murali Karicheri
2016-02-16 20:24 ` David Miller
2016-02-18 17:13 ` Murali Karicheri
2016-02-18 20:08 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=063D6719AE5E284EB5DD2968C1650D6D1CCDBFCC@AcuExch.aculab.com \
--to=david.laight@aculab.com \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=fcooper@ti.com \
--cc=grygorii.strashko@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m-karicheri2@ti.com \
--cc=mugunthanvnm@ti.com \
--cc=netdev@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=w-kwok2@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®