netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3 1/4] ibmveth: change rx buffer default allocation for CMO
@ 2015-04-29 21:25 Thomas Falcon
  2015-04-29 21:25 ` [PATCH net-next v3 2/4] ibmveth: Add support for TSO Thomas Falcon
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Thomas Falcon @ 2015-04-29 21:25 UTC (permalink / raw)
  To: netdev; +Cc: linuxppc-dev, nfont, eric.dumazet, Brian King

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.9.3

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

* [PATCH net-next v3 2/4] ibmveth: Add support for TSO
  2015-04-29 21:25 [PATCH net-next v3 1/4] ibmveth: change rx buffer default allocation for CMO Thomas Falcon
@ 2015-04-29 21:25 ` Thomas Falcon
  2015-04-30 20:34   ` David Miller
  2015-04-29 21:25 ` [PATCH net-next v3 3/4] ibmveth: Add GRO support Thomas Falcon
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Thomas Falcon @ 2015-04-29 21:25 UTC (permalink / raw)
  To: netdev; +Cc: linuxppc-dev, nfont, eric.dumazet, Brian King

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>
---
v2: Included statistics that were previously in a separate patch

 drivers/net/ethernet/ibm/ibmveth.c | 19 ++++++++++++++++++-
 drivers/net/ethernet/ibm/ibmveth.h |  1 +
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 0210622..25cfc26 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");
@@ -100,6 +100,7 @@ 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) },
 };
 
 /* simple methods of getting data from the current rxq entry */
@@ -852,6 +853,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 +1040,15 @@ 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);
+		adapter->tx_large_packets++;
+	}
+
 	if (ibmveth_send(adapter, descs)) {
 		adapter->tx_send_failed++;
 		netdev->stats.tx_dropped++;
@@ -1422,6 +1436,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))
diff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h
index 0dc664b..56d1e22 100644
--- a/drivers/net/ethernet/ibm/ibmveth.h
+++ b/drivers/net/ethernet/ibm/ibmveth.h
@@ -161,6 +161,7 @@ struct ibmveth_adapter {
     u64 rx_no_buffer;
     u64 tx_map_failed;
     u64 tx_send_failed;
+    u64 tx_large_packets;
 };
 
 /*
-- 
1.9.3

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

* [PATCH net-next v3 3/4] ibmveth: Add GRO support
  2015-04-29 21:25 [PATCH net-next v3 1/4] ibmveth: change rx buffer default allocation for CMO Thomas Falcon
  2015-04-29 21:25 ` [PATCH net-next v3 2/4] ibmveth: Add support for TSO Thomas Falcon
@ 2015-04-29 21:25 ` Thomas Falcon
  2015-04-30 20:34   ` David Miller
  2015-04-29 21:25 ` [PATCH net-next v3 4/4] ibmveth: Add support for Large Receive Offload Thomas Falcon
  2015-04-30 20:34 ` [PATCH net-next v3 1/4] ibmveth: change rx buffer default allocation for CMO David Miller
  3 siblings, 1 reply; 8+ messages in thread
From: Thomas Falcon @ 2015-04-29 21:25 UTC (permalink / raw)
  To: netdev; +Cc: linuxppc-dev, nfont, eric.dumazet, Brian King

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 25cfc26..f0ec4e5 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1139,7 +1139,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.9.3

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

* [PATCH net-next v3 4/4] ibmveth: Add support for Large Receive Offload
  2015-04-29 21:25 [PATCH net-next v3 1/4] ibmveth: change rx buffer default allocation for CMO Thomas Falcon
  2015-04-29 21:25 ` [PATCH net-next v3 2/4] ibmveth: Add support for TSO Thomas Falcon
  2015-04-29 21:25 ` [PATCH net-next v3 3/4] ibmveth: Add GRO support Thomas Falcon
@ 2015-04-29 21:25 ` Thomas Falcon
  2015-04-30 20:34   ` David Miller
  2015-04-30 20:34 ` [PATCH net-next v3 1/4] ibmveth: change rx buffer default allocation for CMO David Miller
  3 siblings, 1 reply; 8+ messages in thread
From: Thomas Falcon @ 2015-04-29 21:25 UTC (permalink / raw)
  To: netdev; +Cc: linuxppc-dev, nfont, eric.dumazet, Brian King

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>
---
v3:
 -Removed code setting network and transport headers
 -get IP header from skb data
  Thanks again to Eric Dumazet

v2:
 -Included statistics that were previously in a separate patch
 -Zeroed the IP header checksum before calling ip_fast_csum
  Thanks to Eric Dumazet.

 drivers/net/ethernet/ibm/ibmveth.c | 17 ++++++++++++++++-
 drivers/net/ethernet/ibm/ibmveth.h |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index f0ec4e5..4468124 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -101,6 +101,7 @@ struct ibmveth_stat ibmveth_stats[] = {
 	{ "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 */
@@ -1094,6 +1095,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) {
@@ -1136,8 +1138,21 @@ 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) {
+					iph = (struct iphdr *)skb->data;
+
+					/* 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 = 0;
+						iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
+						adapter->rx_large_packets++;
+					}
+				}
+			}
 
 			napi_gro_receive(napi, skb);	/* send it up */
 
diff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h
index 56d1e22..41dedb1 100644
--- a/drivers/net/ethernet/ibm/ibmveth.h
+++ b/drivers/net/ethernet/ibm/ibmveth.h
@@ -162,6 +162,7 @@ struct ibmveth_adapter {
     u64 tx_map_failed;
     u64 tx_send_failed;
     u64 tx_large_packets;
+    u64 rx_large_packets;
 };
 
 /*
-- 
1.9.3

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

* Re: [PATCH net-next v3 1/4] ibmveth: change rx buffer default allocation for CMO
  2015-04-29 21:25 [PATCH net-next v3 1/4] ibmveth: change rx buffer default allocation for CMO Thomas Falcon
                   ` (2 preceding siblings ...)
  2015-04-29 21:25 ` [PATCH net-next v3 4/4] ibmveth: Add support for Large Receive Offload Thomas Falcon
@ 2015-04-30 20:34 ` David Miller
  3 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2015-04-30 20:34 UTC (permalink / raw)
  To: tlfalcon; +Cc: netdev, linuxppc-dev, nfont, eric.dumazet, brking

From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date: Wed, 29 Apr 2015 16:25:44 -0500

> 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>

Applied.

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

* Re: [PATCH net-next v3 2/4] ibmveth: Add support for TSO
  2015-04-29 21:25 ` [PATCH net-next v3 2/4] ibmveth: Add support for TSO Thomas Falcon
@ 2015-04-30 20:34   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2015-04-30 20:34 UTC (permalink / raw)
  To: tlfalcon; +Cc: netdev, linuxppc-dev, nfont, eric.dumazet, brking

From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date: Wed, 29 Apr 2015 16:25:45 -0500

> 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>
> ---
> v2: Included statistics that were previously in a separate patch

Applied.

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

* Re: [PATCH net-next v3 3/4] ibmveth: Add GRO support
  2015-04-29 21:25 ` [PATCH net-next v3 3/4] ibmveth: Add GRO support Thomas Falcon
@ 2015-04-30 20:34   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2015-04-30 20:34 UTC (permalink / raw)
  To: tlfalcon; +Cc: netdev, linuxppc-dev, nfont, eric.dumazet, brking

From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date: Wed, 29 Apr 2015 16:25:46 -0500

> Cc: Brian King <brking@linux.vnet.ibm.com>
> Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>

Applied.

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

* Re: [PATCH net-next v3 4/4] ibmveth: Add support for Large Receive Offload
  2015-04-29 21:25 ` [PATCH net-next v3 4/4] ibmveth: Add support for Large Receive Offload Thomas Falcon
@ 2015-04-30 20:34   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2015-04-30 20:34 UTC (permalink / raw)
  To: tlfalcon; +Cc: netdev, linuxppc-dev, nfont, eric.dumazet, brking

From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date: Wed, 29 Apr 2015 16:25:47 -0500

> 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>
> ---
> v3:
>  -Removed code setting network and transport headers
>  -get IP header from skb data
>   Thanks again to Eric Dumazet
> 
> v2:
>  -Included statistics that were previously in a separate patch
>  -Zeroed the IP header checksum before calling ip_fast_csum
>   Thanks to Eric Dumazet.

Applied.

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

end of thread, other threads:[~2015-04-30 20:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-29 21:25 [PATCH net-next v3 1/4] ibmveth: change rx buffer default allocation for CMO Thomas Falcon
2015-04-29 21:25 ` [PATCH net-next v3 2/4] ibmveth: Add support for TSO Thomas Falcon
2015-04-30 20:34   ` David Miller
2015-04-29 21:25 ` [PATCH net-next v3 3/4] ibmveth: Add GRO support Thomas Falcon
2015-04-30 20:34   ` David Miller
2015-04-29 21:25 ` [PATCH net-next v3 4/4] ibmveth: Add support for Large Receive Offload Thomas Falcon
2015-04-30 20:34   ` David Miller
2015-04-30 20:34 ` [PATCH net-next v3 1/4] 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).