lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5F5C53CE-40BF-484B-96CC-A26BF789AE48@intel.com>
Date:	Fri, 20 Nov 2015 23:56:41 +0000
From:	"Rustad, Mark D" <mark.d.rustad@...el.com>
To:	Tom Herbert <tom@...bertland.com>
CC:	"davem@...emloft.net" <davem@...emloft.net>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"kernel-team@...com" <kernel-team@...com>
Subject: Re: [PATCH 13/15] ixgbe: Convert to advertise NETIF_F_HW_CSUM

Tom Herbert <tom@...bertland.com> wrote:

> The skb_csum_offload_chk is used to resolve checksums that are unable
> to be offloaded to the device.
> 
> Signed-off-by: Tom Herbert <tom@...bertland.com>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 41 +++++++++++++++++++--------
> 1 file changed, 29 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 80823f5..26c1633 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

<snip>

> static void ixgbe_tx_csum(struct ixgbe_ring *tx_ring,
> -			  struct ixgbe_tx_buffer *first)
> +			  struct ixgbe_tx_buffer *first,
> +			  struct ixgbe_adapter *adapter)

This added parameter should not be needed. See below.

> {
> 	struct sk_buff *skb = first->skb;
> 	u32 vlan_macip_lens = 0;
> 	u32 mss_l4len_idx = 0;
> 	u32 type_tucmd = 0;
> +	bool csum_encapped;
> 
> -	if (skb->ip_summed != CHECKSUM_PARTIAL) {
> +	if (!skb_csum_offload_chk(skb, &csum_offl_spec, &csum_encapped, true)) {
> +no_csum:
> 		if (!(first->tx_flags & IXGBE_TX_FLAGS_HW_VLAN) &&
> 		    !(first->tx_flags & IXGBE_TX_FLAGS_CC))
> 			return;
> @@ -7025,7 +7038,15 @@ static void ixgbe_tx_csum(struct ixgbe_ring *tx_ring,
> 			u8 *raw;
> 		} transport_hdr;
> 
> -		if (skb->encapsulation) {
> +		if (csum_encapped) {
> +			switch (adapter->hw.mac.type) {
> +			case ixgbe_mac_X550:
> +			case ixgbe_mac_X550EM_x:
> +				break;
> +			default:
> +				skb_checksum_help(skb);
> +				goto no_csum;
> +			}
> 			network_hdr.raw = skb_inner_network_header(skb);
> 			transport_hdr.raw = skb_inner_transport_header(skb);
> 			vlan_macip_lens = skb_inner_network_offset(skb) <<

The switch checking the mac type above is not needed. All of the ixgbe devices can handle encapsulated tx checksum offload. The X550 series
has the ability to offload the rx side as well, but is not a factor
here. That also means that the added adapter parameter would not be
needed.

> @@ -7602,7 +7623,7 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
> 	if (tso < 0)
> 		goto out_drop;
> 	else if (!tso)
> -		ixgbe_tx_csum(tx_ring, first);
> +		ixgbe_tx_csum(tx_ring, first, adapter);
> 
> 	/* add the ATR filter if ATR is on */
> 	if (test_bit(__IXGBE_TX_FDIR_INIT_DONE, &tx_ring->state))

<snip>

> @@ -8794,12 +8814,10 @@ skip_sriov:
> 
> 	netdev->vlan_features |= NETIF_F_TSO;
> 	netdev->vlan_features |= NETIF_F_TSO6;
> -	netdev->vlan_features |= NETIF_F_IP_CSUM;
> -	netdev->vlan_features |= NETIF_F_IPV6_CSUM;
> +	netdev->vlan_features |= NETIF_F_HW_CSUM;
> 	netdev->vlan_features |= NETIF_F_SG;
> 
> -	netdev->hw_enc_features |= NETIF_F_SG | NETIF_F_IP_CSUM |
> -				   NETIF_F_IPV6_CSUM;
> +	netdev->hw_enc_features |= NETIF_F_SG | NETIF_F_HW_CSUM;
> 
> 	netdev->priv_flags |= IFF_UNICAST_FLT;
> 	netdev->priv_flags |= IFF_SUPP_NOFCS;
> @@ -8809,8 +8827,7 @@ skip_sriov:
> 	case ixgbe_mac_X550:
> 	case ixgbe_mac_X550EM_x:
> 		netdev->hw_enc_features |= NETIF_F_RXCSUM |
> -					   NETIF_F_IP_CSUM |
> -					   NETIF_F_IPV6_CSUM;
> +					   NETIF_F_HW_CSUM;

This is actually redundant, because the bit in hw_enc_features was set above. I already have a patch in queue that changes the statement above to only set the NETIF_F_RXCSUM for the X550 devices because the other bits were set just above. So once my patch is applied, this last hunk won't be needed here.

--
Mark Rustad, Networking Division, Intel Corporation

Download attachment "signature.asc" of type "application/pgp-signature" (842 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ