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] [day] [month] [year] [list]
Message-ID: <8ffa3734-e3eb-4a07-ab7c-3e227c34044e@intel.com>
Date: Tue, 22 Apr 2025 16:15:32 -0700
From: "Chittim, Madhu" <madhu.chittim@...el.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>, "Nguyen, Anthony L"
	<anthony.l.nguyen@...el.com>, "davem@...emloft.net" <davem@...emloft.net>,
	"kuba@...nel.org" <kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>,
	"Dumazet, Eric" <edumazet@...gle.com>, "andrew+netdev@...n.ch"
	<andrew+netdev@...n.ch>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "willemb@...gle.com" <willemb@...gle.com>, "Samudrala, Sridhar"
	<sridhar.samudrala@...el.com>, Zachary Goldstein <zachmgoldstein@...gle.com>,
	"Salin, Samuel" <samuel.salin@...el.com>
Subject: Re: [PATCH net 3/3] idpf: fix offloads support for encapsulated
 packets



On 4/22/2025 3:56 PM, Willem de Bruijn wrote:
> Tony Nguyen wrote:
>> From: Madhu Chittim <madhu.chittim@...el.com>
>>
>> Split offloads into csum, tso and other offloads so that tunneled
>> packets do not by default have all the offloads enabled.
>>
>> Stateless offloads for encapsulated packets are not yet supported in
>> firmware/software but in the driver we were setting the features same as
>> non encapsulated features.
>>
>> Fixed naming to clarify CSUM bits are being checked for Tx.
>>
>> Inherit netdev features to VLAN interfaces as well.
>>
>> Fixes: 0fe45467a104 ("idpf: add create vport and netdev configuration")
>> Reviewed-by: Sridhar Samudrala <sridhar.samudrala@...el.com>
>> Signed-off-by: Madhu Chittim <madhu.chittim@...el.com>
>> Tested-by: Zachary Goldstein <zachmgoldstein@...gle.com>
>> Tested-by: Samuel Salin <Samuel.salin@...el.com>
>> Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.com>
>> ---
>>   drivers/net/ethernet/intel/idpf/idpf.h     | 14 ++++--
>>   drivers/net/ethernet/intel/idpf/idpf_lib.c | 57 ++++++++--------------
>>   2 files changed, 29 insertions(+), 42 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/idpf/idpf.h b/drivers/net/ethernet/intel/idpf/idpf.h
>> index 66544faab710..5f73a4cf5161 100644
>> --- a/drivers/net/ethernet/intel/idpf/idpf.h
>> +++ b/drivers/net/ethernet/intel/idpf/idpf.h
>> @@ -633,10 +633,18 @@ bool idpf_is_capability_ena(struct idpf_adapter *adapter, bool all,
>>   	VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_TCP	|\
>>   	VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_UDP)
>>   
>> +#define IDPF_CAP_TX_CSUM_L4V4 (\
>> +	VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_TCP	|\
>> +	VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_UDP)
>> +
>>   #define IDPF_CAP_RX_CSUM_L4V6 (\
>>   	VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_TCP	|\
>>   	VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_UDP)
>>   
>> +#define IDPF_CAP_TX_CSUM_L4V6 (\
>> +	VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_TCP	|\
>> +	VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_UDP)
>> +
>>   #define IDPF_CAP_RX_CSUM (\
>>   	VIRTCHNL2_CAP_RX_CSUM_L3_IPV4		|\
>>   	VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_TCP	|\
>> @@ -644,11 +652,9 @@ bool idpf_is_capability_ena(struct idpf_adapter *adapter, bool all,
>>   	VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_TCP	|\
>>   	VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_UDP)
>>   
>> -#define IDPF_CAP_SCTP_CSUM (\
>> +#define IDPF_CAP_TX_SCTP_CSUM (\
>>   	VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_SCTP	|\
>> -	VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_SCTP	|\
>> -	VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_SCTP	|\
>> -	VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_SCTP)
>> +	VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_SCTP)
>>   
>>   #define IDPF_CAP_TUNNEL_TX_CSUM (\
>>   	VIRTCHNL2_CAP_TX_CSUM_L3_SINGLE_TUNNEL	|\
>> diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
>> index aa755dedb41d..730a9c7a59f2 100644
>> --- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
>> +++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
>> @@ -703,8 +703,10 @@ static int idpf_cfg_netdev(struct idpf_vport *vport)
>>   {
>>   	struct idpf_adapter *adapter = vport->adapter;
>>   	struct idpf_vport_config *vport_config;
>> +	netdev_features_t other_offloads = 0;
>> +	netdev_features_t csum_offloads = 0;
>> +	netdev_features_t tso_offloads = 0;
>>   	netdev_features_t dflt_features;
>> -	netdev_features_t offloads = 0;
>>   	struct idpf_netdev_priv *np;
>>   	struct net_device *netdev;
>>   	u16 idx = vport->idx;
>> @@ -766,53 +768,32 @@ static int idpf_cfg_netdev(struct idpf_vport *vport)
>>   
>>   	if (idpf_is_cap_ena_all(adapter, IDPF_RSS_CAPS, IDPF_CAP_RSS))
>>   		dflt_features |= NETIF_F_RXHASH;
>> -	if (idpf_is_cap_ena_all(adapter, IDPF_CSUM_CAPS, IDPF_CAP_RX_CSUM_L4V4))
>> -		dflt_features |= NETIF_F_IP_CSUM;
>> -	if (idpf_is_cap_ena_all(adapter, IDPF_CSUM_CAPS, IDPF_CAP_RX_CSUM_L4V6))
>> -		dflt_features |= NETIF_F_IPV6_CSUM;
> 
> IDPF_CAP_RX_CSUM_L4V4 and IDPF_CAP_RX_CSUM_L4V6 are no longer used
> after this commit, so the definitions (above) should be removed?

Thank you, will fix it in next version.

>> +	if (idpf_is_cap_ena_all(adapter, IDPF_CSUM_CAPS, IDPF_CAP_TX_CSUM_L4V4))
>> +		csum_offloads |= NETIF_F_IP_CSUM;
>> +	if (idpf_is_cap_ena_all(adapter, IDPF_CSUM_CAPS, IDPF_CAP_TX_CSUM_L4V6))
>> +		csum_offloads |= NETIF_F_IPV6_CSUM;
>>   	if (idpf_is_cap_ena(adapter, IDPF_CSUM_CAPS, IDPF_CAP_RX_CSUM))
>> -		dflt_features |= NETIF_F_RXCSUM;
>> -	if (idpf_is_cap_ena_all(adapter, IDPF_CSUM_CAPS, IDPF_CAP_SCTP_CSUM))
>> -		dflt_features |= NETIF_F_SCTP_CRC;
>> +		csum_offloads |= NETIF_F_RXCSUM;
>> +	if (idpf_is_cap_ena_all(adapter, IDPF_CSUM_CAPS, IDPF_CAP_TX_SCTP_CSUM))
>> +		csum_offloads |= NETIF_F_SCTP_CRC;
>>   
>>   	if (idpf_is_cap_ena(adapter, IDPF_SEG_CAPS, VIRTCHNL2_CAP_SEG_IPV4_TCP))
>> -		dflt_features |= NETIF_F_TSO;
>> +		tso_offloads |= NETIF_F_TSO;
>>   	if (idpf_is_cap_ena(adapter, IDPF_SEG_CAPS, VIRTCHNL2_CAP_SEG_IPV6_TCP))
>> -		dflt_features |= NETIF_F_TSO6;
>> +		tso_offloads |= NETIF_F_TSO6;
>>   	if (idpf_is_cap_ena_all(adapter, IDPF_SEG_CAPS,
>>   				VIRTCHNL2_CAP_SEG_IPV4_UDP |
>>   				VIRTCHNL2_CAP_SEG_IPV6_UDP))
>> -		dflt_features |= NETIF_F_GSO_UDP_L4;
>> +		tso_offloads |= NETIF_F_GSO_UDP_L4;
>>   	if (idpf_is_cap_ena_all(adapter, IDPF_RSC_CAPS, IDPF_CAP_RSC))
>> -		offloads |= NETIF_F_GRO_HW;
>> -	/* advertise to stack only if offloads for encapsulated packets is
>> -	 * supported
>> -	 */
>> -	if (idpf_is_cap_ena(vport->adapter, IDPF_SEG_CAPS,
>> -			    VIRTCHNL2_CAP_SEG_TX_SINGLE_TUNNEL)) {
>> -		offloads |= NETIF_F_GSO_UDP_TUNNEL	|
>> -			    NETIF_F_GSO_GRE		|
>> -			    NETIF_F_GSO_GRE_CSUM	|
>> -			    NETIF_F_GSO_PARTIAL		|
>> -			    NETIF_F_GSO_UDP_TUNNEL_CSUM	|
>> -			    NETIF_F_GSO_IPXIP4		|
>> -			    NETIF_F_GSO_IPXIP6		|
>> -			    0;
>> -
>> -		if (!idpf_is_cap_ena_all(vport->adapter, IDPF_CSUM_CAPS,
>> -					 IDPF_CAP_TUNNEL_TX_CSUM))
>> -			netdev->gso_partial_features |=
>> -				NETIF_F_GSO_UDP_TUNNEL_CSUM;
>> -
>> -		netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
>> -		offloads |= NETIF_F_TSO_MANGLEID;
>> -	}
>> +		other_offloads |= NETIF_F_GRO_HW;
>>   	if (idpf_is_cap_ena(adapter, IDPF_OTHER_CAPS, VIRTCHNL2_CAP_LOOPBACK))
>> -		offloads |= NETIF_F_LOOPBACK;
>> +		other_offloads |= NETIF_F_LOOPBACK;
>>   
>> -	netdev->features |= dflt_features;
>> -	netdev->hw_features |= dflt_features | offloads;
>> -	netdev->hw_enc_features |= dflt_features | offloads;
>> +	netdev->features |= dflt_features | csum_offloads | tso_offloads;
>> +	netdev->hw_features |=  netdev->features | other_offloads;
>> +	netdev->vlan_features |= netdev->features | other_offloads;
>> +	netdev->hw_enc_features |= dflt_features | other_offloads;
>>   	idpf_set_ethtool_ops(netdev);
>>   	netif_set_affinity_auto(netdev);
>>   	SET_NETDEV_DEV(netdev, &adapter->pdev->dev);
>> -- 
>> 2.47.1
>>
> 
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ