[PATCH] Fix encoding of ethernet frame length for big endian platforms in QCA7000/7005 protocol header.
From: kornel . swierzy
Date: Tue Aug 22 2023 - 03:00:36 EST
From: Kornel Swierzy <kornel.swierzy@xxxxxxxxxxxx>
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@xxxxxxxxxxxx>
---
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