* [PATCH net-next v2 1/2] Revert "net: thunderbolt: Use separate header data type for the Rx"
@ 2022-11-30 12:24 Andy Shevchenko
2022-11-30 12:24 ` [PATCH net-next v2 2/2] net: thunderbolt: Use bitwise types in the struct thunderbolt_ip_frame_header Andy Shevchenko
2022-11-30 12:34 ` [PATCH net-next v2 1/2] Revert "net: thunderbolt: Use separate header data type for the Rx" Andy Shevchenko
0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2022-11-30 12:24 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: Michael Jamet, Mika Westerberg, Yehezkel Bernat, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andy Shevchenko
This reverts commit 9ad63a3dad65b984ba16f5841163457dec266be4.
---
v2: added tag (Mika)
drivers/net/thunderbolt.c | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)
diff --git a/drivers/net/thunderbolt.c b/drivers/net/thunderbolt.c
index 0fc2d9222a71..c73d419f1456 100644
--- a/drivers/net/thunderbolt.c
+++ b/drivers/net/thunderbolt.c
@@ -58,32 +58,12 @@
* supported then @frame_id is filled, otherwise it stays %0.
*/
struct thunderbolt_ip_frame_header {
- __le32 frame_size;
- __le16 frame_index;
- __le16 frame_id;
- __le32 frame_count;
-};
-
-/* Same as &struct thunderbolt_ip_frame_header for Rx */
-struct thunderbolt_ip_frame_rx_hdr {
u32 frame_size;
u16 frame_index;
u16 frame_id;
u32 frame_count;
};
-static_assert(sizeof(struct thunderbolt_ip_frame_header) ==
- sizeof(struct thunderbolt_ip_frame_rx_hdr));
-
-#define TBIP_FRAME_HDR_MATCH(x) \
- static_assert(offsetof(struct thunderbolt_ip_frame_header, frame_##x) == \
- offsetof(struct thunderbolt_ip_frame_rx_hdr, frame_##x))
-TBIP_FRAME_HDR_MATCH(size);
-TBIP_FRAME_HDR_MATCH(index);
-TBIP_FRAME_HDR_MATCH(id);
-TBIP_FRAME_HDR_MATCH(count);
-#undef TBIP_FRAME_HDR_MATCH
-
enum thunderbolt_ip_frame_pdf {
TBIP_PDF_FRAME_START = 1,
TBIP_PDF_FRAME_END,
@@ -213,7 +193,7 @@ struct tbnet {
struct delayed_work login_work;
struct work_struct connected_work;
struct work_struct disconnect_work;
- struct thunderbolt_ip_frame_rx_hdr rx_hdr;
+ struct thunderbolt_ip_frame_header rx_hdr;
struct tbnet_ring rx_ring;
atomic_t frame_id;
struct tbnet_ring tx_ring;
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH net-next v2 2/2] net: thunderbolt: Use bitwise types in the struct thunderbolt_ip_frame_header
2022-11-30 12:24 [PATCH net-next v2 1/2] Revert "net: thunderbolt: Use separate header data type for the Rx" Andy Shevchenko
@ 2022-11-30 12:24 ` Andy Shevchenko
2022-11-30 12:34 ` [PATCH net-next v2 1/2] Revert "net: thunderbolt: Use separate header data type for the Rx" Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2022-11-30 12:24 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: Michael Jamet, Mika Westerberg, Yehezkel Bernat, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andy Shevchenko
The main usage of the struct thunderbolt_ip_frame_header is to handle
the packets on the media layer. The header is bound to the protocol
in which the byte ordering is crucial. However the data type definition
doesn't use that and sparse is unhappy, for example (17 altogether):
.../thunderbolt.c:718:23: warning: cast to restricted __le32
.../thunderbolt.c:966:42: warning: incorrect type in assignment (different base types)
.../thunderbolt.c:966:42: expected unsigned int [usertype] frame_count
.../thunderbolt.c:966:42: got restricted __le32 [usertype]
Switch to the bitwise types in the struct thunderbolt_ip_frame_header to
reduce this, but not completely solving (9 left), because the same data
type is used for Rx header handled locally (in CPU byte order).
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: changed only types without splitting the data type (Mika)
drivers/net/thunderbolt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/thunderbolt.c b/drivers/net/thunderbolt.c
index c73d419f1456..4ed7f5b547e3 100644
--- a/drivers/net/thunderbolt.c
+++ b/drivers/net/thunderbolt.c
@@ -58,10 +58,10 @@
* supported then @frame_id is filled, otherwise it stays %0.
*/
struct thunderbolt_ip_frame_header {
- u32 frame_size;
- u16 frame_index;
- u16 frame_id;
- u32 frame_count;
+ __le32 frame_size;
+ __le16 frame_index;
+ __le16 frame_id;
+ __le32 frame_count;
};
enum thunderbolt_ip_frame_pdf {
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next v2 1/2] Revert "net: thunderbolt: Use separate header data type for the Rx"
2022-11-30 12:24 [PATCH net-next v2 1/2] Revert "net: thunderbolt: Use separate header data type for the Rx" Andy Shevchenko
2022-11-30 12:24 ` [PATCH net-next v2 2/2] net: thunderbolt: Use bitwise types in the struct thunderbolt_ip_frame_header Andy Shevchenko
@ 2022-11-30 12:34 ` Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2022-11-30 12:34 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: Michael Jamet, Mika Westerberg, Yehezkel Bernat, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
On Wed, Nov 30, 2022 at 02:24:38PM +0200, Andy Shevchenko wrote:
> This reverts commit 9ad63a3dad65b984ba16f5841163457dec266be4.
Ah wrong SHA was taken, sorry for the noise.
v3 will be sent soon.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-30 12:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-30 12:24 [PATCH net-next v2 1/2] Revert "net: thunderbolt: Use separate header data type for the Rx" Andy Shevchenko
2022-11-30 12:24 ` [PATCH net-next v2 2/2] net: thunderbolt: Use bitwise types in the struct thunderbolt_ip_frame_header Andy Shevchenko
2022-11-30 12:34 ` [PATCH net-next v2 1/2] Revert "net: thunderbolt: Use separate header data type for the Rx" Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).