@@ -1262,7 +1262,7 @@ static int ehea_clean_portres(struct ehea_port *port, struct ehea_port_res *pr)
12621262static inline void write_ip_start_end (struct ehea_swqe * swqe ,
12631263 const struct sk_buff * skb )
12641264{
1265- swqe -> ip_start = ( u8 )((( u64 ) skb -> nh . iph ) - (( u64 ) skb -> data ) );
1265+ swqe -> ip_start = skb_network_offset ( skb );
12661266 swqe -> ip_end = (u8 )(swqe -> ip_start + ip_hdrlen (skb ) - 1 );
12671267}
12681268
@@ -1688,6 +1688,7 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,
16881688 struct ehea_swqe * swqe , u32 lkey )
16891689{
16901690 if (skb -> protocol == htons (ETH_P_IP )) {
1691+ const struct iphdr * iph = ip_hdr (skb );
16911692 /* IPv4 */
16921693 swqe -> tx_control |= EHEA_SWQE_CRC
16931694 | EHEA_SWQE_IP_CHECKSUM
@@ -1697,15 +1698,15 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,
16971698
16981699 write_ip_start_end (swqe , skb );
16991700
1700- if (skb -> nh . iph -> protocol == IPPROTO_UDP ) {
1701- if ((skb -> nh . iph -> frag_off & IP_MF ) ||
1702- (skb -> nh . iph -> frag_off & IP_OFFSET ))
1701+ if (iph -> protocol == IPPROTO_UDP ) {
1702+ if ((iph -> frag_off & IP_MF ) ||
1703+ (iph -> frag_off & IP_OFFSET ))
17031704 /* IP fragment, so don't change cs */
17041705 swqe -> tx_control &= ~EHEA_SWQE_TCP_CHECKSUM ;
17051706 else
17061707 write_udp_offset_end (swqe , skb );
17071708
1708- } else if (skb -> nh . iph -> protocol == IPPROTO_TCP ) {
1709+ } else if (iph -> protocol == IPPROTO_TCP ) {
17091710 write_tcp_offset_end (swqe , skb );
17101711 }
17111712
@@ -1731,20 +1732,21 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
17311732 int i ;
17321733
17331734 if (skb -> protocol == htons (ETH_P_IP )) {
1735+ const struct iphdr * iph = ip_hdr (skb );
17341736 /* IPv4 */
17351737 write_ip_start_end (swqe , skb );
17361738
1737- if (skb -> nh . iph -> protocol == IPPROTO_TCP ) {
1739+ if (iph -> protocol == IPPROTO_TCP ) {
17381740 swqe -> tx_control |= EHEA_SWQE_CRC
17391741 | EHEA_SWQE_IP_CHECKSUM
17401742 | EHEA_SWQE_TCP_CHECKSUM
17411743 | EHEA_SWQE_IMM_DATA_PRESENT ;
17421744
17431745 write_tcp_offset_end (swqe , skb );
17441746
1745- } else if (skb -> nh . iph -> protocol == IPPROTO_UDP ) {
1746- if ((skb -> nh . iph -> frag_off & IP_MF ) ||
1747- (skb -> nh . iph -> frag_off & IP_OFFSET ))
1747+ } else if (iph -> protocol == IPPROTO_UDP ) {
1748+ if ((iph -> frag_off & IP_MF ) ||
1749+ (iph -> frag_off & IP_OFFSET ))
17481750 /* IP fragment, so don't change cs */
17491751 swqe -> tx_control |= EHEA_SWQE_CRC
17501752 | EHEA_SWQE_IMM_DATA_PRESENT ;
0 commit comments