Skip to content

Commit 722946b

Browse files
committed
bnx2x: adopt skb_network_offset() and similar helpers
JIRA: https://issues.redhat.com/browse/RHEL-52258 JIRA: https://issues.redhat.com/browse/RHEL-52667 Conflicts: Only the bnx2x hunks. commit 80bfab7 Author: Eric Dumazet <edumazet@google.com> Date: Thu Feb 29 09:39:07 2024 +0000 net: adopt skb_network_offset() and similar helpers This is a cleanup patch, making code a bit more concise. 1) Use skb_network_offset(skb) in place of (skb_network_header(skb) - skb->data) 2) Use -skb_network_offset(skb) in place of (skb->data - skb_network_header(skb)) 3) Use skb_transport_offset(skb) in place of (skb_transport_header(skb) - skb->data) 4) Use skb_inner_transport_offset(skb) in place of (skb_inner_transport_header(skb) - skb->data) Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Edward Cree <ecree.xilinx@gmail.com> # for sfc Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
1 parent a4413d6 commit 722946b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3538,7 +3538,7 @@ static u8 bnx2x_set_pbd_csum_enc(struct bnx2x *bp, struct sk_buff *skb,
35383538
u32 *parsing_data, u32 xmit_type)
35393539
{
35403540
*parsing_data |=
3541-
((((u8 *)skb_inner_transport_header(skb) - skb->data) >> 1) <<
3541+
((skb_inner_transport_offset(skb) >> 1) <<
35423542
ETH_TX_PARSE_BD_E2_L4_HDR_START_OFFSET_W_SHIFT) &
35433543
ETH_TX_PARSE_BD_E2_L4_HDR_START_OFFSET_W;
35443544

@@ -3570,7 +3570,7 @@ static u8 bnx2x_set_pbd_csum_e2(struct bnx2x *bp, struct sk_buff *skb,
35703570
u32 *parsing_data, u32 xmit_type)
35713571
{
35723572
*parsing_data |=
3573-
((((u8 *)skb_transport_header(skb) - skb->data) >> 1) <<
3573+
((skb_transport_offset(skb) >> 1) <<
35743574
ETH_TX_PARSE_BD_E2_L4_HDR_START_OFFSET_W_SHIFT) &
35753575
ETH_TX_PARSE_BD_E2_L4_HDR_START_OFFSET_W;
35763576

@@ -3613,7 +3613,7 @@ static u8 bnx2x_set_pbd_csum(struct bnx2x *bp, struct sk_buff *skb,
36133613
struct eth_tx_parse_bd_e1x *pbd,
36143614
u32 xmit_type)
36153615
{
3616-
u8 hlen = (skb_network_header(skb) - skb->data) >> 1;
3616+
u8 hlen = skb_network_offset(skb) >> 1;
36173617

36183618
/* for now NS flag is not used in Linux */
36193619
pbd->global_data =
@@ -3667,8 +3667,7 @@ static void bnx2x_update_pbds_gso_enc(struct sk_buff *skb,
36673667
u8 outerip_off, outerip_len = 0;
36683668

36693669
/* from outer IP to transport */
3670-
hlen_w = (skb_inner_transport_header(skb) -
3671-
skb_network_header(skb)) >> 1;
3670+
hlen_w = skb_inner_transport_offset(skb) >> 1;
36723671

36733672
/* transport len */
36743673
hlen_w += inner_tcp_hdrlen(skb) >> 1;
@@ -3714,7 +3713,7 @@ static void bnx2x_update_pbds_gso_enc(struct sk_buff *skb,
37143713
0, IPPROTO_TCP, 0));
37153714
}
37163715

3717-
outerip_off = (skb_network_header(skb) - skb->data) >> 1;
3716+
outerip_off = (skb_network_offset(skb)) >> 1;
37183717

37193718
*global_data |=
37203719
outerip_off |

0 commit comments

Comments
 (0)