Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbe735e4 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller
Browse files

[SK_BUFF]: Introduce skb_network_offset()



For the quite common 'skb->nh.raw - skb->data' sequence.

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e7dd65da
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1121,7 +1121,7 @@ isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev)
	if (!skb)
		return;
	if (lp->p_encap == ISDN_NET_ENCAP_ETHER) {
		int pullsize = (ulong)skb->nh.raw - (ulong)skb->data - ETH_HLEN;
		const int pullsize = skb_network_offset(skb) - ETH_HLEN;
		if (pullsize > 0) {
			printk(KERN_DEBUG "isdn_net: Pull junk %d\n", pullsize);
			skb_pull(skb, pullsize);
+1 −1
Original line number Diff line number Diff line
@@ -1300,7 +1300,7 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
			    ~csum_tcpudp_magic(skb->nh.iph->saddr,
					       skb->nh.iph->daddr, 0,
					       IPPROTO_TCP, 0);
			ipofst = skb->nh.raw - skb->data;
			ipofst = skb_network_offset(skb);
			if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */
				tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT;

+1 −1
Original line number Diff line number Diff line
@@ -1865,7 +1865,7 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)

		++st->tx_tso;

		eth_type = skb->nh.raw - skb->data == ETH_HLEN ?
		eth_type = skb_network_offset(skb) == ETH_HLEN ?
			CPL_ETH_II : CPL_ETH_II_VLAN;

		hdr = (struct cpl_tx_pkt_lso *)skb_push(skb, sizeof(*hdr));
+1 −1
Original line number Diff line number Diff line
@@ -897,7 +897,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb,
		d->flit[2] = 0;
		cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT_LSO);
		hdr->cntrl = htonl(cntrl);
		eth_type = skb->nh.raw - skb->data == ETH_HLEN ?
		eth_type = skb_network_offset(skb) == ETH_HLEN ?
		    CPL_ETH_II : CPL_ETH_II_VLAN;
		tso_info |= V_LSO_ETH_TYPE(eth_type) |
		    V_LSO_IPHDR_WORDS(skb->nh.iph->ihl) |
+1 −1
Original line number Diff line number Diff line
@@ -2910,7 +2910,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
						 0);
			ipcse = 0;
		}
		ipcss = skb->nh.raw - skb->data;
		ipcss = skb_network_offset(skb);
		ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data;
		tucss = skb->h.raw - skb->data;
		tucso = (void *)&(skb->h.th->check) - (void *)skb->data;
Loading