linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] ibmveth: change rx buffer default allocation for CMO
@ 2015-04-14 20:35 Thomas Falcon
  2015-04-14 20:35 ` [PATCH 2/5] ibmveth: Add support for TSO Thomas Falcon
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Thomas Falcon @ 2015-04-14 20:35 UTC (permalink / raw)
  To: netdev; +Cc: Brian King, linuxppc-dev

This patch enables 64k rx buffer pools by default.  If Cooperative
Memory Overcommitment (CMO) is enabled, the number of 64k buffers
is reduced to save memory.

Cc: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
 drivers/net/ethernet/ibm/ibmveth.c | 3 +++
 drivers/net/ethernet/ibm/ibmveth.h | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index cd7675a..0210622 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1424,6 +1424,9 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
 
 	memcpy(netdev->dev_addr, mac_addr_p, ETH_ALEN);
 
+	if (firmware_has_feature(FW_FEATURE_CMO))
+		memcpy(pool_count, pool_count_cmo, sizeof(pool_count));
+
 	for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++) {
 		struct kobject *kobj = &adapter->rx_buff_pool[i].kobj;
 		int error;
diff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h
index 1f37499..0dc664b 100644
--- a/drivers/net/ethernet/ibm/ibmveth.h
+++ b/drivers/net/ethernet/ibm/ibmveth.h
@@ -104,7 +104,8 @@ static inline long h_illan_attributes(unsigned long unit_address,
 
 static int pool_size[] = { 512, 1024 * 2, 1024 * 16, 1024 * 32, 1024 * 64 };
 static int pool_count[] = { 256, 512, 256, 256, 256 };
-static int pool_active[] = { 1, 1, 0, 0, 0};
+static int pool_count_cmo[] = { 256, 512, 256, 256, 64 };
+static int pool_active[] = { 1, 1, 0, 0, 1};
 
 #define IBM_VETH_INVALID_MAP ((u16)0xffff)
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/5] ibmveth: Add support for TSO
  2015-04-14 20:35 [PATCH 1/5] ibmveth: change rx buffer default allocation for CMO Thomas Falcon
@ 2015-04-14 20:35 ` Thomas Falcon
  2015-04-14 20:35 ` [PATCH 3/5] ibmveth: Add GRO support Thomas Falcon
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Thomas Falcon @ 2015-04-14 20:35 UTC (permalink / raw)
  To: netdev; +Cc: Brian King, linuxppc-dev

Add support for TSO.  TSO is turned off by default and
must be enabled and configured by the user.  The driver
version number is increased so that users can be sure
that they are using ibmveth with TSO support.

Cc: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
 drivers/net/ethernet/ibm/ibmveth.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 0210622..2911a57 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -58,7 +58,7 @@ static struct kobj_type ktype_veth_pool;
 
 static const char ibmveth_driver_name[] = "ibmveth";
 static const char ibmveth_driver_string[] = "IBM Power Virtual Ethernet Driver";
-#define ibmveth_driver_version "1.04"
+#define ibmveth_driver_version "1.05"
 
 MODULE_AUTHOR("Santiago Leon <santil@linux.vnet.ibm.com>");
 MODULE_DESCRIPTION("IBM Power Virtual Ethernet Driver");
@@ -852,6 +852,10 @@ static int ibmveth_set_features(struct net_device *dev,
 	struct ibmveth_adapter *adapter = netdev_priv(dev);
 	int rx_csum = !!(features & NETIF_F_RXCSUM);
 	int rc;
+	netdev_features_t changed = features ^ dev->features;
+
+	if (features & NETIF_F_TSO & changed)
+		netdev_info(dev, "TSO feature requires all partitions to have updated driver");
 
 	if (rx_csum == adapter->rx_csum)
 		return 0;
@@ -1035,6 +1039,14 @@ retry_bounce:
 		descs[i+1].fields.address = dma_addr;
 	}
 
+	if (skb_is_gso(skb) && !skb_is_gso_v6(skb)) {
+		/* Put -1 in the IP checksum to tell phyp it
+		 *  is a largesend packet and put the mss in the TCP checksum.
+		 */
+		ip_hdr(skb)->check = 0xffff;
+		tcp_hdr(skb)->check = cpu_to_be16(skb_shinfo(skb)->gso_size);
+	}
+
 	if (ibmveth_send(adapter, descs)) {
 		adapter->tx_send_failed++;
 		netdev->stats.tx_dropped++;
@@ -1422,6 +1434,9 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
 		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
 	netdev->features |= netdev->hw_features;
 
+	/* TSO is disabled by default */
+	netdev->hw_features |= NETIF_F_TSO;
+
 	memcpy(netdev->dev_addr, mac_addr_p, ETH_ALEN);
 
 	if (firmware_has_feature(FW_FEATURE_CMO))
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/5] ibmveth: Add GRO support
  2015-04-14 20:35 [PATCH 1/5] ibmveth: change rx buffer default allocation for CMO Thomas Falcon
  2015-04-14 20:35 ` [PATCH 2/5] ibmveth: Add support for TSO Thomas Falcon
@ 2015-04-14 20:35 ` Thomas Falcon
  2015-04-14 20:35 ` [PATCH 4/5] ibmveth: Add support for Large Receive Offload Thomas Falcon
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Thomas Falcon @ 2015-04-14 20:35 UTC (permalink / raw)
  To: netdev; +Cc: Brian King, linuxppc-dev

Cc: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
 drivers/net/ethernet/ibm/ibmveth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 2911a57..08970c7 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1137,7 +1137,7 @@ restart_poll:
 			if (csum_good)
 				skb->ip_summed = CHECKSUM_UNNECESSARY;
 
-			netif_receive_skb(skb);	/* send it up */
+			napi_gro_receive(napi, skb);	/* send it up */
 
 			netdev->stats.rx_packets++;
 			netdev->stats.rx_bytes += length;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/5] ibmveth: Add support for Large Receive Offload
  2015-04-14 20:35 [PATCH 1/5] ibmveth: change rx buffer default allocation for CMO Thomas Falcon
  2015-04-14 20:35 ` [PATCH 2/5] ibmveth: Add support for TSO Thomas Falcon
  2015-04-14 20:35 ` [PATCH 3/5] ibmveth: Add GRO support Thomas Falcon
@ 2015-04-14 20:35 ` Thomas Falcon
  2015-04-14 22:00   ` Eric Dumazet
  2015-04-14 20:35 ` [PATCH 5/5] ibmveth: Add ethtool statistics for tx and rx large packets Thomas Falcon
  2015-04-14 20:53 ` [PATCH 1/5] ibmveth: change rx buffer default allocation for CMO David Miller
  4 siblings, 1 reply; 8+ messages in thread
From: Thomas Falcon @ 2015-04-14 20:35 UTC (permalink / raw)
  To: netdev; +Cc: Brian King, linuxppc-dev

Enables receiving large packets from other LPARs. These packets
have a -1 IP header checksum, so we must recalculate to have
a valid checksum.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
 drivers/net/ethernet/ibm/ibmveth.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 08970c7..05eaca6a 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1092,6 +1092,7 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
 	struct net_device *netdev = adapter->netdev;
 	int frames_processed = 0;
 	unsigned long lpar_rc;
+	struct iphdr *iph;
 
 restart_poll:
 	while (frames_processed < budget) {
@@ -1134,8 +1135,20 @@ restart_poll:
 			skb_put(skb, length);
 			skb->protocol = eth_type_trans(skb, netdev);
 
-			if (csum_good)
+			if (csum_good) {
 				skb->ip_summed = CHECKSUM_UNNECESSARY;
+				if (be16_to_cpu(skb->protocol) == ETH_P_IP) {
+					skb_set_network_header(skb, 0);
+					skb_set_transport_header(skb, sizeof(struct iphdr));
+					iph = ip_hdr(skb);
+
+					/* If the IP checksum is not offloaded and if the packet
+					 *  is large send, the checksum must be rebuilt.
+					 */
+					if (iph->check == 0xffff)
+						iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
+				}
+			}
 
 			napi_gro_receive(napi, skb);	/* send it up */
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/5] ibmveth: Add ethtool statistics for tx and rx large packets
  2015-04-14 20:35 [PATCH 1/5] ibmveth: change rx buffer default allocation for CMO Thomas Falcon
                   ` (2 preceding siblings ...)
  2015-04-14 20:35 ` [PATCH 4/5] ibmveth: Add support for Large Receive Offload Thomas Falcon
@ 2015-04-14 20:35 ` Thomas Falcon
  2015-04-14 20:53 ` [PATCH 1/5] ibmveth: change rx buffer default allocation for CMO David Miller
  4 siblings, 0 replies; 8+ messages in thread
From: Thomas Falcon @ 2015-04-14 20:35 UTC (permalink / raw)
  To: netdev; +Cc: Brian King, linuxppc-dev

This patch includes counters for transmitted and received large
packets.

Cc: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
 drivers/net/ethernet/ibm/ibmveth.c | 4 ++++
 drivers/net/ethernet/ibm/ibmveth.h | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 05eaca6a..39ab41e 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -100,6 +100,8 @@ struct ibmveth_stat ibmveth_stats[] = {
 	{ "tx_send_failed", IBMVETH_STAT_OFF(tx_send_failed) },
 	{ "fw_enabled_ipv4_csum", IBMVETH_STAT_OFF(fw_ipv4_csum_support) },
 	{ "fw_enabled_ipv6_csum", IBMVETH_STAT_OFF(fw_ipv6_csum_support) },
+	{ "tx_large_packets", IBMVETH_STAT_OFF(tx_large_packets) },
+	{ "rx_large_packets", IBMVETH_STAT_OFF(rx_large_packets) }
 };
 
 /* simple methods of getting data from the current rxq entry */
@@ -1045,6 +1047,7 @@ retry_bounce:
 		 */
 		ip_hdr(skb)->check = 0xffff;
 		tcp_hdr(skb)->check = cpu_to_be16(skb_shinfo(skb)->gso_size);
+		adapter->tx_large_packets++;
 	}
 
 	if (ibmveth_send(adapter, descs)) {
@@ -1147,6 +1150,7 @@ restart_poll:
 					 */
 					if (iph->check == 0xffff)
 						iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
+						adapter->rx_large_packets++;
 				}
 			}
 
diff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h
index 0dc664b..41dedb1 100644
--- a/drivers/net/ethernet/ibm/ibmveth.h
+++ b/drivers/net/ethernet/ibm/ibmveth.h
@@ -161,6 +161,8 @@ struct ibmveth_adapter {
     u64 rx_no_buffer;
     u64 tx_map_failed;
     u64 tx_send_failed;
+    u64 tx_large_packets;
+    u64 rx_large_packets;
 };
 
 /*
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/5] ibmveth: change rx buffer default allocation for CMO
  2015-04-14 20:35 [PATCH 1/5] ibmveth: change rx buffer default allocation for CMO Thomas Falcon
                   ` (3 preceding siblings ...)
  2015-04-14 20:35 ` [PATCH 5/5] ibmveth: Add ethtool statistics for tx and rx large packets Thomas Falcon
@ 2015-04-14 20:53 ` David Miller
  4 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2015-04-14 20:53 UTC (permalink / raw)
  To: tlfalcon; +Cc: brking, netdev, linuxppc-dev


The net-next tree is closed, so new feature submissions are not appropriate at this
time.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/5] ibmveth: Add support for Large Receive Offload
  2015-04-14 20:35 ` [PATCH 4/5] ibmveth: Add support for Large Receive Offload Thomas Falcon
@ 2015-04-14 22:00   ` Eric Dumazet
  2015-04-21 18:59     ` Thomas Falcon
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2015-04-14 22:00 UTC (permalink / raw)
  To: Thomas Falcon; +Cc: Brian King, netdev, linuxppc-dev

On Tue, 2015-04-14 at 15:35 -0500, Thomas Falcon wrote:
> Enables receiving large packets from other LPARs. These packets
> have a -1 IP header checksum, so we must recalculate to have
> a valid checksum.
> 
> Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
> Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
> ---
>  drivers/net/ethernet/ibm/ibmveth.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> index 08970c7..05eaca6a 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -1092,6 +1092,7 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
>  	struct net_device *netdev = adapter->netdev;
>  	int frames_processed = 0;
>  	unsigned long lpar_rc;
> +	struct iphdr *iph;
>  
>  restart_poll:
>  	while (frames_processed < budget) {
> @@ -1134,8 +1135,20 @@ restart_poll:
>  			skb_put(skb, length);
>  			skb->protocol = eth_type_trans(skb, netdev);
>  
> -			if (csum_good)
> +			if (csum_good) {
>  				skb->ip_summed = CHECKSUM_UNNECESSARY;
> +				if (be16_to_cpu(skb->protocol) == ETH_P_IP) {
> +					skb_set_network_header(skb, 0);
> +					skb_set_transport_header(skb, sizeof(struct iphdr));
> +					iph = ip_hdr(skb);
> +
> +					/* If the IP checksum is not offloaded and if the packet
> +					 *  is large send, the checksum must be rebuilt.
> +					 */
> +					if (iph->check == 0xffff)
> +						iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);


How can this possibly work ?

Normally you would have to set iph->check to 0 before calling
ip_fast_csum(), as done in ip_send_check()

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/5] ibmveth: Add support for Large Receive Offload
  2015-04-14 22:00   ` Eric Dumazet
@ 2015-04-21 18:59     ` Thomas Falcon
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Falcon @ 2015-04-21 18:59 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Brian King, netdev, linuxppc-dev

On 04/14/2015 05:00 PM, Eric Dumazet wrote:
> On Tue, 2015-04-14 at 15:35 -0500, Thomas Falcon wrote:
>> Enables receiving large packets from other LPARs. These packets
>> have a -1 IP header checksum, so we must recalculate to have
>> a valid checksum.
>>
>> Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
>> Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
>> ---
>>  drivers/net/ethernet/ibm/ibmveth.c | 15 ++++++++++++++-
>>  1 file changed, 14 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
>> index 08970c7..05eaca6a 100644
>> --- a/drivers/net/ethernet/ibm/ibmveth.c
>> +++ b/drivers/net/ethernet/ibm/ibmveth.c
>> @@ -1092,6 +1092,7 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
>>  	struct net_device *netdev = adapter->netdev;
>>  	int frames_processed = 0;
>>  	unsigned long lpar_rc;
>> +	struct iphdr *iph;
>>  
>>  restart_poll:
>>  	while (frames_processed < budget) {
>> @@ -1134,8 +1135,20 @@ restart_poll:
>>  			skb_put(skb, length);
>>  			skb->protocol = eth_type_trans(skb, netdev);
>>  
>> -			if (csum_good)
>> +			if (csum_good) {
>>  				skb->ip_summed = CHECKSUM_UNNECESSARY;
>> +				if (be16_to_cpu(skb->protocol) == ETH_P_IP) {
>> +					skb_set_network_header(skb, 0);
>> +					skb_set_transport_header(skb, sizeof(struct iphdr));
>> +					iph = ip_hdr(skb);
>> +
>> +					/* If the IP checksum is not offloaded and if the packet
>> +					 *  is large send, the checksum must be rebuilt.
>> +					 */
>> +					if (iph->check == 0xffff)
>> +						iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
>
> How can this possibly work ?
>
> Normally you would have to set iph->check to 0 before calling
> ip_fast_csum(), as done in ip_send_check()
I don't have an answer for why I weren't seeing any problems while testing this, but I'll go back and set iph->check to zero and retest.  Thanks for noticing this.
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-04-21 18:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-14 20:35 [PATCH 1/5] ibmveth: change rx buffer default allocation for CMO Thomas Falcon
2015-04-14 20:35 ` [PATCH 2/5] ibmveth: Add support for TSO Thomas Falcon
2015-04-14 20:35 ` [PATCH 3/5] ibmveth: Add GRO support Thomas Falcon
2015-04-14 20:35 ` [PATCH 4/5] ibmveth: Add support for Large Receive Offload Thomas Falcon
2015-04-14 22:00   ` Eric Dumazet
2015-04-21 18:59     ` Thomas Falcon
2015-04-14 20:35 ` [PATCH 5/5] ibmveth: Add ethtool statistics for tx and rx large packets Thomas Falcon
2015-04-14 20:53 ` [PATCH 1/5] ibmveth: change rx buffer default allocation for CMO David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).