Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Aug 2016 12:39:58 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        pyunyh@gmail.com
Cc:        Pyun YongHyeon <yongari@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r304439 - head/sys/dev/usb/net
Message-ID:  <63a25b6b-4503-b136-7765-7744108db1a1@selasky.org>
In-Reply-To: <20160819092223.GG1186@michelle.fasterthan.co.kr>
References:  <201608190050.u7J0oWkW043171@repo.freebsd.org> <464a63e6-e96c-a2d5-099d-ae9059fa0877@selasky.org> <20160819085511.GF1186@michelle.fasterthan.co.kr> <2e8143d4-eb32-693d-e5a4-49c380c100df@selasky.org> <20160819092223.GG1186@michelle.fasterthan.co.kr>

next in thread | previous in thread | raw e-mail | index | archive | help
On 08/19/16 11:22, YongHyeon PYUN wrote:
> On Fri, Aug 19, 2016 at 11:11:56AM +0200, Hans Petter Selasky wrote:
>> On 08/19/16 10:55, YongHyeon PYUN wrote:
>>> I think the order is right but it was not tested on big-endian
>>> systems.
>>
>> Hi,
>>
>> I'm pretty sure the ifdef is wrong, because you write the fields one at
>> a time, using htole32():
>>
>>                         txhdr.mss = 0;
>>                         txhdr.len = htole32(AXGE_TXBYTES(m->m_pkthdr.len));
>>
>> Big endian machines don't re-order variables like this.
>>
>> You should remove the #else part.
>
> Wouldn't USB stack pass txhdr structure without any
> modification? And controller want to see len (low 32bits address)
> first and then mss (high 32bits address). On big endian systems I
> guess this should be reversed in host memory layout.  This is so
> confusing so I could be wrong.

The USB stack passes TXHDR as-is and the host controller is byte 
oriented, not 64-bit word oriented. That's why the layout is the same as 
long as you assign per 32-bit field.

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?63a25b6b-4503-b136-7765-7744108db1a1>