Skip to contentSkip to conversation

s390 network patches

PATCH New Ursula Braun 1 participant 8 messages Dec 11, 2015

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover s390 network patches

Hi Dave,

here are some s390 related patches for net-next. Most important is the skb_linearize af_iucv patch from Eugene solving traffic problems in certain scenarios. The remaining patches are minor improvements.

Thanks, Ursula

Eugene Crosser (2):
iucv: prevent information leak in iucv_message
iucv: call skb_linearize() when needed

Markus Elfring (1):
s390-ctcm: Delete unnecessary checks before the function call
"channel_remove"

Rasmus Villemoes (1):
qeth: get rid of redundant 0-termination

Ursula Braun (3):
MAINTAINERS: switch to alternate IBM mail address
qeth: initialize net_device with carrier off
qeth: repair SBAL elements calculation

 MAINTAINERS                       |  4 ++--
 drivers/s390/net/ctcm_main.c      |  7 ++-----
 drivers/s390/net/qeth_core_main.c |  2 --
 drivers/s390/net/qeth_l2_main.c   |  1 +
 drivers/s390/net/qeth_l3_main.c   |  3 ++-
 net/iucv/af_iucv.c                | 22 ++++++++++++++++------
 6 files changed, 23 insertions(+), 16 deletions(-)
Signature · 1 line
2.3.9
#1 lore raw

PATCH 1/7 iucv: prevent information leak in iucv_message

From: Eugene Crosser <[email protected]>

Initialize storage for the future IUCV header that will be included in the transmitted packet. Some of the header fields are unused with HiperSockets transport, and will contain data left from some other functions.

---
 net/iucv/af_iucv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/iucv/af_iucv.c +1 -1
index 3ea4c98..5bc473b 100644
@@ -1031,7 +1031,7 @@ static int iucv_sock_sendmsg(struct socket *sock, struct msghdr *msg,
 	struct sock *sk = sock->sk;
 	struct iucv_sock *iucv = iucv_sk(sk);
 	struct sk_buff *skb;
-	struct iucv_message txmsg;
+	struct iucv_message txmsg = {0};
 	struct cmsghdr *cmsg;
 	int cmsg_done;
 	long timeo;
Signature · 1 line
2.3.9
#2 lore raw

PATCH 2/7 iucv: call skb_linearize() when needed

In reply to Ursula Braun

From: Eugene Crosser <[email protected]>

When the linear buffer of the received sk_buff is shorter than the header, use skb_linearize(). sk_buffs with short linear buffer happen on the sending side under high traffic, and some kernel configurations, when allocated buffer starts just before page boundary, and IUCV transport has to send it as two separate QDIO buffer elements, with fist element shorter than the header.

---
 net/iucv/af_iucv.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
net/iucv/af_iucv.c +15 -5
index 5bc473b..ef50a94 100644
@@ -2084,11 +2084,7 @@ static int afiucv_hs_callback_rx(struct sock *sk, struct sk_buff *skb)
 		return NET_RX_SUCCESS;
 	}
 
-		/* write stuff from iucv_msg to skb cb */
-	if (skb->len < sizeof(struct af_iucv_trans_hdr)) {
-		kfree_skb(skb);
-		return NET_RX_SUCCESS;
-	}
+	/* write stuff from iucv_msg to skb cb */
 	skb_pull(skb, sizeof(struct af_iucv_trans_hdr));
 	skb_reset_transport_header(skb);
 	skb_reset_network_header(skb);
@@ -2119,6 +2115,20 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev,
 	char nullstring[8];
 	int err = 0;
 
+	if (skb->len < (ETH_HLEN + sizeof(struct af_iucv_trans_hdr))) {
+		WARN_ONCE(1, "AF_IUCV too short skb, len=%d, min=%d",
+			  (int)skb->len,
+			  (int)(ETH_HLEN + sizeof(struct af_iucv_trans_hdr)));
+		kfree_skb(skb);
+		return NET_RX_SUCCESS;
+	}
+	if (skb_headlen(skb) < (ETH_HLEN + sizeof(struct af_iucv_trans_hdr)))
+		if (skb_linearize(skb)) {
+			WARN_ONCE(1, "AF_IUCV skb_linearize failed, len=%d",
+				  (int)skb->len);
+			kfree_skb(skb);
+			return NET_RX_SUCCESS;
+		}
 	skb_pull(skb, ETH_HLEN);
 	trans_hdr = (struct af_iucv_trans_hdr *)skb->data;
 	EBCASC(trans_hdr->destAppName, sizeof(trans_hdr->destAppName));
Signature · 1 line
2.3.9
#3 lore raw

PATCH 3/7 switch to alternate IBM mail address

In reply to Ursula Braun
---
 MAINTAINERS | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
MAINTAINERS +2 -2
index 8eba565..f62648e 100644
@@ -9125,7 +9125,7 @@ F:	drivers/s390/block/dasd*
 F:	block/partitions/ibm.c
 
 S390 NETWORK DRIVERS
-M:	Ursula Braun <[email protected]>
+M:	Ursula Braun <[email protected]>
 L:	[email protected]
 W:	http://www.ibm.com/developerworks/linux/linux390/
 S:	Supported
@@ -9155,7 +9155,7 @@ S:	Supported
 F:	drivers/s390/scsi/zfcp_*
 
 S390 IUCV NETWORK LAYER
-M:	Ursula Braun <[email protected]>
+M:	Ursula Braun <[email protected]>
 L:	[email protected]
 W:	http://www.ibm.com/developerworks/linux/linux390/
 S:	Supported
Signature · 1 line
2.3.9
#4 lore raw

PATCH 4/7 s390-ctcm: Delete unnecessary checks before the function call "channel_remove"

In reply to Ursula Braun

From: Markus Elfring <[email protected]>

The channel_remove() function tests whether its argument is NULL and then returns immediately. Thus the test around the calls is not needed.

This issue was detected by using the Coccinelle software.

---
 drivers/s390/net/ctcm_main.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/s390/net/ctcm_main.c +2 -5
index 05c37d6..c3e2252 100644
@@ -1677,11 +1677,8 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev)
 
 	ccw_device_set_offline(cgdev->cdev[1]);
 	ccw_device_set_offline(cgdev->cdev[0]);
-
-	if (priv->channel[CTCM_READ])
-		channel_remove(priv->channel[CTCM_READ]);
-	if (priv->channel[CTCM_WRITE])
-		channel_remove(priv->channel[CTCM_WRITE]);
+	channel_remove(priv->channel[CTCM_READ]);
+	channel_remove(priv->channel[CTCM_WRITE]);
 	priv->channel[CTCM_READ] = priv->channel[CTCM_WRITE] = NULL;
 
 	return 0;
Signature · 1 line
2.3.9
#5 lore raw

PATCH 5/7 qeth: initialize net_device with carrier off

In reply to Ursula Braun

/sys/class/net/<interface>/operstate for an active qeth network interface offen shows "unknown", which translates to "state UNKNOWN in output of "ip link show". It is caused by a missing initialization of the __LINK_STATE_NOCARRIER bit in the net_device state field. This patch adds a netif_carrier_off() invocation when creating the net_device for a qeth device.

Reference-ID: Bugzilla 133209

---
 drivers/s390/net/qeth_l2_main.c | 1 +
 drivers/s390/net/qeth_l3_main.c | 1 +
 2 files changed, 2 insertions(+)
drivers/s390/net/qeth_l2_main.c +1 -0
index 8f1b091..80b1979 100644
@@ -1126,6 +1126,7 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
 	qeth_l2_request_initial_mac(card);
 	SET_NETDEV_DEV(card->dev, &card->gdev->dev);
 	netif_napi_add(card->dev, &card->napi, qeth_l2_poll, QETH_NAPI_WEIGHT);
+	netif_carrier_off(card->dev);
 	return register_netdev(card->dev);
 }
 
drivers/s390/net/qeth_l3_main.c +1 -0
index 543960e..9541167 100644
@@ -3220,6 +3220,7 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
 
 	SET_NETDEV_DEV(card->dev, &card->gdev->dev);
 	netif_napi_add(card->dev, &card->napi, qeth_l3_poll, QETH_NAPI_WEIGHT);
+	netif_carrier_off(card->dev);
 	return register_netdev(card->dev);
 }
 
Signature · 1 line
2.3.9
#6 lore raw

PATCH 6/7 qeth: repair SBAL elements calculation

In reply to Ursula Braun

When sending skbs, qeth determines the number of qdio SBAL elements required. If qeth sends a fragmented skb, the SBAL element number calculation is wrong, because the fragmented data part is added twice in qeth_l3_tso_elements(). This patch makes sure fragmented data is handled in qeth_elements_for_frags() only, while qeth_l3_tso_elements() starts calculation of qdio SBAL elements just with the linear data part of the skb.

---
 drivers/s390/net/qeth_l3_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/net/qeth_l3_main.c +1 -1
index 9541167..b9d8ea4 100644
@@ -2818,7 +2818,7 @@ static inline int qeth_l3_tso_elements(struct sk_buff *skb)
 {
 	unsigned long tcpd = (unsigned long)tcp_hdr(skb) +
 		tcp_hdr(skb)->doff * 4;
-	int tcpd_len = skb->len - (tcpd - (unsigned long)skb->data);
+	int tcpd_len = skb_headlen(skb) - (tcpd - (unsigned long)skb->data);
 	int elements = PFN_UP(tcpd + tcpd_len - 1) - PFN_DOWN(tcpd);
 
 	elements += qeth_get_elements_for_frags(skb);
Signature · 1 line
2.3.9
#7 lore raw

PATCH 7/7 qeth: get rid of redundant 0-termination

In reply to Ursula Braun

From: Rasmus Villemoes <[email protected]>

0-termination is redundant, since sprintf has done that.

---
 drivers/s390/net/qeth_core_main.c | 2 --
 1 file changed, 2 deletions(-)
drivers/s390/net/qeth_core_main.c +0 -2
index 31ac53f..7b6ba07 100644
@@ -2684,8 +2684,6 @@ void qeth_print_status_message(struct qeth_card *card)
 			sprintf(card->info.mcl_level, "%02x%02x",
 				card->info.mcl_level[2],
 				card->info.mcl_level[3]);
-
-			card->info.mcl_level[QETH_MCL_LENGTH] = 0;
 			break;
 		}
 		/* fallthrough */
Signature · 1 line
2.3.9