diff mbox series

[net-next,3/4] net: mvpp2: get rid of hard coded assumptions

Message ID 20220210175557.1843151-4-eric.dumazet@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: make MAX_SKB_FRAGS configurable | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 6 this patch: 6
netdev/cc_maintainers warning 2 maintainers not CCed: mw@semihalf.com linux@armlinux.org.uk
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 6 this patch: 6
netdev/checkpatch warning WARNING: line length of 113 exceeds 80 columns WARNING: line length of 116 exceeds 80 columns WARNING: line length of 117 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Eric Dumazet Feb. 10, 2022, 5:55 p.m. UTC
From: Eric Dumazet <edumazet@google.com>

A driver should not assume anything about sizeof(struct skb_shared_info),
or L1_CACHE_BYTES value.

Commit 704e624f7b3e ("net: mvvp2: fix short frame size on s390")
tried to fix this issue for s390, but it seems
MVPP2_BM_SHORT_FRAME_SIZE, MVPP2_BM_LONG_FRAME_SIZE and
MVPP2_BM_JUMBO_FRAME_SIZE should be precise.

We want to be able to tweak MAX_SKB_FRAGS in the future,
without breaking the build.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
index ad73a488fc5fb6de4ddbf980355e31944b980e08..3dc0132a1fd569f7e75bfbef586c65163f0466c7 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
@@ -938,9 +938,9 @@  enum mvpp22_ptp_packet_format {
 #define MVPP2_BM_COOKIE_POOL_OFFS	8
 #define MVPP2_BM_COOKIE_CPU_OFFS	24
 
-#define MVPP2_BM_SHORT_FRAME_SIZE	736	/* frame size 128 */
-#define MVPP2_BM_LONG_FRAME_SIZE	2240	/* frame size 1664 */
-#define MVPP2_BM_JUMBO_FRAME_SIZE	10432	/* frame size 9856 */
+#define MVPP2_BM_SHORT_FRAME_SIZE	(128 + MVPP2_SKB_HEADROOM + MVPP2_SKB_SHINFO_SIZE)	/* frame size 128 */
+#define MVPP2_BM_LONG_FRAME_SIZE	(1664 + MVPP2_SKB_HEADROOM + MVPP2_SKB_SHINFO_SIZE)	/* frame size 1664 */
+#define MVPP2_BM_JUMBO_FRAME_SIZE	(9856 + MVPP2_SKB_HEADROOM + MVPP2_SKB_SHINFO_SIZE) /* frame size 9856 */
 /* BM short pool packet size
  * These value assure that for SWF the total number
  * of bytes allocated for each buffer will be 512