All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.h.duyck@intel.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: davem@davemloft.net,
	Joseph Gasparakis <joseph.gasparakis@intel.com>,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com
Subject: Re: [net-next 02/13] ixgbe: Adding Tx encapsulation capability
Date: Wed, 30 Jan 2013 08:58:46 -0800	[thread overview]
Message-ID: <51095146.7030404@intel.com> (raw)
In-Reply-To: <1359546286-18179-3-git-send-email-jeffrey.t.kirsher@intel.com>

NAK, this is not a production patch.  This was just meant to be proof of
concept code.

Thanks,

Alex

On 01/30/2013 03:44 AM, Jeff Kirsher wrote:
> From: Joseph Gasparakis <joseph.gasparakis@intel.com>
> 
> This patch allows ixgbe to recognize encapsulated packets and do the
> Tx checksum offload in hardware.
> 
> Signed-off-by: Joseph Gasparakis <joseph.gasparakis@intel.com>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 46 +++++++++++++++++++++------
>  1 file changed, 37 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 5989b3f..3719f32 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -5975,17 +5975,42 @@ static void ixgbe_tx_csum(struct ixgbe_ring *tx_ring,
>  		if (!(first->tx_flags & IXGBE_TX_FLAGS_HW_VLAN) &&
>  		    !(first->tx_flags & IXGBE_TX_FLAGS_CC))
>  			return;
> +		vlan_macip_lens |= skb_network_offset(skb) <<
> +				   IXGBE_ADVTXD_MACLEN_SHIFT;
>  	} else {
>  		u8 l4_hdr = 0;
> -		switch (first->protocol) {
> -		case __constant_htons(ETH_P_IP):
> -			vlan_macip_lens |= skb_network_header_len(skb);
> +		union {
> +			struct iphdr *ipv4;
> +			struct ipv6hdr *ipv6;
> +			u8 *raw;
> +		} network_hdr;
> +		union {
> +			struct tcphdr *tcphdr;
> +			u8 *raw;
> +		} transport_hdr;
> +
> +		if (skb->encapsulation) {
> +			network_hdr.raw = skb_inner_network_header(skb);
> +			transport_hdr.raw = skb_inner_transport_header(skb);
> +			vlan_macip_lens |= skb_inner_network_offset(skb) <<
> +					   IXGBE_ADVTXD_MACLEN_SHIFT;
> +		} else {
> +			network_hdr.raw = skb_network_header(skb);
> +			transport_hdr.raw = skb_transport_header(skb);
> +			vlan_macip_lens |= skb_network_offset(skb) <<
> +					   IXGBE_ADVTXD_MACLEN_SHIFT;
> +		}
> +
> +		/* use first 4 bits to determine IP version */
> +		switch (network_hdr.ipv4->version) {
> +		case 4:
> +			vlan_macip_lens |= transport_hdr.raw - network_hdr.raw;
>  			type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4;
> -			l4_hdr = ip_hdr(skb)->protocol;
> +			l4_hdr = network_hdr.ipv4->protocol;
>  			break;
> -		case __constant_htons(ETH_P_IPV6):
> -			vlan_macip_lens |= skb_network_header_len(skb);
> -			l4_hdr = ipv6_hdr(skb)->nexthdr;
> +		case 6:
> +			vlan_macip_lens |= transport_hdr.raw - network_hdr.raw;
> +			l4_hdr = network_hdr.ipv6->nexthdr;
>  			break;
>  		default:
>  			if (unlikely(net_ratelimit())) {
> @@ -5999,7 +6024,7 @@ static void ixgbe_tx_csum(struct ixgbe_ring *tx_ring,
>  		switch (l4_hdr) {
>  		case IPPROTO_TCP:
>  			type_tucmd |= IXGBE_ADVTXD_TUCMD_L4T_TCP;
> -			mss_l4len_idx = tcp_hdrlen(skb) <<
> +			mss_l4len_idx = (transport_hdr.tcphdr->doff * 4) <<
>  					IXGBE_ADVTXD_L4LEN_SHIFT;
>  			break;
>  		case IPPROTO_SCTP:
> @@ -6025,7 +6050,6 @@ static void ixgbe_tx_csum(struct ixgbe_ring *tx_ring,
>  	}
>  
>  	/* vlan_macip_lens: MACLEN, VLAN tag */
> -	vlan_macip_lens |= skb_network_offset(skb) << IXGBE_ADVTXD_MACLEN_SHIFT;
>  	vlan_macip_lens |= first->tx_flags & IXGBE_TX_FLAGS_VLAN_MASK;
>  
>  	ixgbe_tx_ctxtdesc(tx_ring, vlan_macip_lens, 0,
> @@ -7406,6 +7430,10 @@ skip_sriov:
>  
>  	netdev->hw_features = netdev->features;
>  
> +	netdev->hw_enc_features = NETIF_F_IP_CSUM |
> +				  NETIF_F_IPV6_CSUM |
> +				  NETIF_F_SG;
> +
>  	switch (adapter->hw.mac.type) {
>  	case ixgbe_mac_82599EB:
>  	case ixgbe_mac_X540:
> 

  reply	other threads:[~2013-01-30 16:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-30 11:44 [net-next 00/13][pull request] Intel Wired LAN Driver Updates 2013.01.30 Jeff Kirsher
2013-01-30 11:44 ` [net-next 01/13] ixgbe: Reset the NIC if up2tc has changed Jeff Kirsher
2013-01-30 11:44 ` [net-next 02/13] ixgbe: Adding Tx encapsulation capability Jeff Kirsher
2013-01-30 16:58   ` Alexander Duyck [this message]
2013-01-30 17:48     ` Eric Dumazet
2013-01-31  0:59       ` Alexander Duyck
2013-01-30 11:44 ` [net-next 03/13] ixgbe: Add debug counters for Tx Encap CSUM Jeff Kirsher
2013-01-30 16:58   ` Alexander Duyck
2013-01-30 11:44 ` [net-next 04/13] ixgbe: Fix device ref count bug Jeff Kirsher
2013-01-30 11:44 ` [net-next 05/13] ixgbe: rename autoneg variables Jeff Kirsher
2013-01-30 11:44 ` [net-next 06/13] ixgbe: removed unused variable from setup_link_speed Jeff Kirsher
2013-01-30 11:44 ` [net-next 07/13] ixgbe: autoneg variable refactoring Jeff Kirsher
2013-01-30 11:44 ` [net-next 08/13] e1000e: cleanup defines.h Jeff Kirsher
2013-01-30 11:44 ` [net-next 09/13] e1000e: cleanup: group OR'ed bit settings with parens Jeff Kirsher
2013-01-30 11:44 ` [net-next 10/13] e1000e: cleanup some whitespace and indentation issues Jeff Kirsher
2013-01-30 11:44 ` [net-next 11/13] e1000e: update driver version string Jeff Kirsher
2013-01-30 11:44 ` [net-next 12/13] e1000e: resolve -Wunused-parameter compile warnings Jeff Kirsher
2013-01-30 11:44 ` [net-next 13/13] e1000e: use generic IEEE MII definitions Jeff Kirsher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51095146.7030404@intel.com \
    --to=alexander.h.duyck@intel.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=joseph.gasparakis@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.