[PATCH] Fix encoding of ethernet frame length for big endian platforms in QCA7000/7005 protocol header.

kornel.swierzy@embevity.com posted 1 patch 2 years, 3 months ago
drivers/net/ethernet/qualcomm/qca_7k_common.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
[PATCH] Fix encoding of ethernet frame length for big endian platforms in QCA7000/7005 protocol header.
Posted by kornel.swierzy@embevity.com 2 years, 3 months ago
From: Kornel Swierzy <kornel.swierzy@embevity.com>

QCA7000 protocol requires that ethernet frame length is encoded
as u16 little endian value. Current implementation does not work
on big endian architectures.

Signed-off-by: Kornel Swierzy <kornel.swierzy@embevity.com>
---
 drivers/net/ethernet/qualcomm/qca_7k_common.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/qca_7k_common.c b/drivers/net/ethernet/qualcomm/qca_7k_common.c
index 6b511f05df61..7bb7ae85fcf7 100644
--- a/drivers/net/ethernet/qualcomm/qca_7k_common.c
+++ b/drivers/net/ethernet/qualcomm/qca_7k_common.c
@@ -30,19 +30,15 @@
 u16
 qcafrm_create_header(u8 *buf, u16 length)
 {
-	__le16 len;
-
 	if (!buf)
 		return 0;
 
-	len = cpu_to_le16(length);
-
 	buf[0] = 0xAA;
 	buf[1] = 0xAA;
 	buf[2] = 0xAA;
 	buf[3] = 0xAA;
-	buf[4] = len & 0xff;
-	buf[5] = (len >> 8) & 0xff;
+	buf[4] = length & 0xff;
+	buf[5] = (length >> 8) & 0xff;
 	buf[6] = 0;
 	buf[7] = 0;
 
-- 
2.25.1
Re: [PATCH] Fix encoding of ethernet frame length for big endian platforms in QCA7000/7005 protocol header.
Posted by Andrew Lunn 2 years, 3 months ago
On Tue, Aug 22, 2023 at 08:59:56AM +0200, kornel.swierzy@embevity.com wrote:
> From: Kornel Swierzy <kornel.swierzy@embevity.com>
> 
> QCA7000 protocol requires that ethernet frame length is encoded
> as u16 little endian value. Current implementation does not work
> on big endian architectures.
> 
> Signed-off-by: Kornel Swierzy <kornel.swierzy@embevity.com>

Hi Kornel

Please take a look at

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#netdev-faq

and

https://docs.kernel.org/process/submitting-patches.html

This appears to be a bugfix, so it should have a Fixes: tag. It then
should be based on the net tree, and this should be indicated in the
Subject: line.

That change itself looks fine, you just have some process issues to
correct.

	Andrew
[PATCH] Fix encoding of ethernet frame length for big endian platforms in QCA7000/7005 protocol header.
Posted by kornel.swierzy@embevity.com 2 years, 3 months ago
From: Kornel Swierzy <kornel.swierzy@embevity.com>

On 8/22/23 18:08, Andrew Lunn wrote:

> On Tue, Aug 22, 2023 at 08:59:56AM +0200, kornel.swierzy@embevity.com wrote:
>> From: Kornel Swierzy <kornel.swierzy@embevity.com>
>>
>> QCA7000 protocol requires that ethernet frame length is encoded
>> as u16 little endian value. Current implementation does not work
>> on big endian architectures.
>>
>> Signed-off-by: Kornel Swierzy <kornel.swierzy@embevity.com>
> Hi Kornel
>
> Please take a look at
>
> https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#netdev-faq
>
> and
>
> https://docs.kernel.org/process/submitting-patches.html
>
> This appears to be a bugfix, so it should have a Fixes: tag. It then
> should be based on the net tree, and this should be indicated in the
> Subject: line.
>
> That change itself looks fine, you just have some process issues to
> correct.
>
> 	Andrew

Hi Andrew,

thanks for the answer and help in submitting my first patch.

I have one question regarding your comment on which I couldn't find any 
answer in the internet: should I post the patch with corrected subject 
and added "fixes" line as an reply to this conversation or it is better 
to submit it as a new patch?


Best regards,

Kornel