Skip to contentSkip to conversation

s390 patches for net-next

PATCH Superseded Ursula Braun 3 participants 13 messages Apr 5, 2017 – Apr 11, 2017

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover s390 patches for net-next

Hi Dave,

here are some cleanup patches for drivers/s390/net.

Thanks, Ursula

Hans Wippel (3):
s390/qeth: improve endianness handling
s390/ctcm: improve endianness handling
s390/netiucv: improve endianness handling

Julian Wiedmann (4):
s390/qeth: use QDIO_*_QFMT defines
s390/qeth: fix up ssqd tracing
s390/qeth: remove unused return value
s390/qeth: Remove unused code

 drivers/s390/net/ctcm_fsms.c      |  2 +-
 drivers/s390/net/ctcm_main.c      | 12 +++++-----
 drivers/s390/net/netiucv.c        |  2 +-
 drivers/s390/net/qeth_core.h      | 16 ++-----------
 drivers/s390/net/qeth_core_main.c | 35 +++++++++++++--------------
 drivers/s390/net/qeth_core_mpc.h  | 17 -------------
 drivers/s390/net/qeth_l2_main.c   |  1 -
 drivers/s390/net/qeth_l2_sys.c    |  3 ---
 drivers/s390/net/qeth_l3_main.c   | 50 ++++++++++++++++++---------------------
 drivers/s390/net/qeth_l3_sys.c    |  4 ++--
 10 files changed, 51 insertions(+), 91 deletions(-)
Signature · 1 line
2.10.2
#1 lore raw

PATCH 1/7 s390/qeth: use QDIO_*_QFMT defines

From: Julian Wiedmann <[email protected]>

better use the constant definitions.

---
 drivers/s390/net/qeth_core_main.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/s390/net/qeth_core_main.c +4 -6
index 315d8a2..3b3cb3b 100644
@@ -4774,12 +4774,10 @@ static int qeth_query_card_info(struct qeth_card *card,
 
 static inline int qeth_get_qdio_q_format(struct qeth_card *card)
 {
-	switch (card->info.type) {
-	case QETH_CARD_TYPE_IQD:
-		return 2;
-	default:
-		return 0;
-	}
+	if (card->info.type == QETH_CARD_TYPE_IQD)
+		return QDIO_IQDIO_QFMT;
+	else
+		return QDIO_QETH_QFMT;
 }
 
 static void qeth_determine_capabilities(struct qeth_card *card)
Signature · 1 line
2.10.2
#2 lore raw

PATCH 2/7 s390/qeth: fix up ssqd tracing

In reply to Ursula Braun

From: Julian Wiedmann <[email protected]>

The ac fields are bitmaps, so format them as hex. While at it, also print the ac2 field.

---
 drivers/s390/net/qeth_core_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/s390/net/qeth_core_main.c +3 -2
index 3b3cb3b..95bd5d8 100644
@@ -4816,8 +4816,9 @@ static void qeth_determine_capabilities(struct qeth_card *card)
 		QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc);
 
 	QETH_DBF_TEXT_(SETUP, 2, "qfmt%d", card->ssqd.qfmt);
-	QETH_DBF_TEXT_(SETUP, 2, "%d", card->ssqd.qdioac1);
-	QETH_DBF_TEXT_(SETUP, 2, "%d", card->ssqd.qdioac3);
+	QETH_DBF_TEXT_(SETUP, 2, "ac1:%02x", card->ssqd.qdioac1);
+	QETH_DBF_TEXT_(SETUP, 2, "ac2:%04x", card->ssqd.qdioac2);
+	QETH_DBF_TEXT_(SETUP, 2, "ac3:%04x", card->ssqd.qdioac3);
 	QETH_DBF_TEXT_(SETUP, 2, "icnt%d", card->ssqd.icnt);
 	if (!((card->ssqd.qfmt != QDIO_IQDIO_QFMT) ||
 	    ((card->ssqd.qdioac1 & CHSC_AC1_INITIATE_INPUTQ) == 0) ||
Signature · 1 line
2.10.2
#3 lore raw

PATCH 3/7 s390/qeth: remove unused return value

In reply to Ursula Braun

From: Julian Wiedmann <[email protected]>

qeth_qdio_output_handler() is the only caller of qeth_handle_send_error() and doesn't care about the return value.

---
 drivers/s390/net/qeth_core.h      | 7 -------
 drivers/s390/net/qeth_core_main.c | 7 +++----
 2 files changed, 3 insertions(+), 11 deletions(-)
drivers/s390/net/qeth_core.h +0 -7
index e7addea..77f7cfd 100644
@@ -503,13 +503,6 @@ struct qeth_qdio_info {
 	int default_out_queue;
 };
 
-enum qeth_send_errors {
-	QETH_SEND_ERROR_NONE,
-	QETH_SEND_ERROR_LINK_FAILURE,
-	QETH_SEND_ERROR_RETRY,
-	QETH_SEND_ERROR_KICK_IT,
-};
-
 #define QETH_ETH_MAC_V4      0x0100 /* like v4 */
 #define QETH_ETH_MAC_V6      0x3333 /* like v6 */
 /* tr mc mac is longer, but that will be enough to detect mc frames */
drivers/s390/net/qeth_core_main.c +3 -4
index 95bd5d8..639b92b 100644
@@ -3322,7 +3322,7 @@ void qeth_queue_input_buffer(struct qeth_card *card, int index)
 }
 EXPORT_SYMBOL_GPL(qeth_queue_input_buffer);
 
-static int qeth_handle_send_error(struct qeth_card *card,
+static void qeth_handle_send_error(struct qeth_card *card,
 		struct qeth_qdio_out_buffer *buffer, unsigned int qdio_err)
 {
 	int sbalf15 = buffer->buffer->element[15].sflags;
@@ -3338,15 +3338,14 @@ static int qeth_handle_send_error(struct qeth_card *card,
 	qeth_check_qdio_errors(card, buffer->buffer, qdio_err, "qouterr");
 
 	if (!qdio_err)
-		return QETH_SEND_ERROR_NONE;
+		return;
 
 	if ((sbalf15 >= 15) && (sbalf15 <= 31))
-		return QETH_SEND_ERROR_RETRY;
+		return;
 
 	QETH_CARD_TEXT(card, 1, "lnkfail");
 	QETH_CARD_TEXT_(card, 1, "%04x %02x",
 		       (u16)qdio_err, (u8)sbalf15);
-	return QETH_SEND_ERROR_LINK_FAILURE;
 }
 
 /*
Signature · 1 line
2.10.2
#4 lore raw

PATCH 4/7 s390/qeth: Remove unused code

In reply to Ursula Braun

From: Julian Wiedmann <[email protected]>

1. options.add_hhlen is set but never used, drop it
2. clean up no longer required forward declarations
3. delete all sorts of unused defines

---
 drivers/s390/net/qeth_core.h      |  5 -----
 drivers/s390/net/qeth_core_main.c |  2 --
 drivers/s390/net/qeth_core_mpc.h  | 17 -----------------
 drivers/s390/net/qeth_l2_main.c   |  1 -
 drivers/s390/net/qeth_l2_sys.c    |  3 ---
 drivers/s390/net/qeth_l3_main.c   |  4 ----
 6 files changed, 32 deletions(-)
drivers/s390/net/qeth_core.h +0 -5
index 77f7cfd..22aa2cd 100644
@@ -509,9 +509,6 @@ struct qeth_qdio_info {
 #define QETH_TR_MAC_NC       0xc000 /* non-canonical */
 #define QETH_TR_MAC_C        0x0300 /* canonical */
 
-#define DEFAULT_ADD_HHLEN 0
-#define MAX_ADD_HHLEN 1024
-
 /**
  * buffer stuff for read channel
  */
@@ -637,7 +634,6 @@ struct qeth_reply {
 	atomic_t refcnt;
 };
 
-
 struct qeth_card_blkt {
 	int time_total;
 	int inter_packet;
@@ -678,7 +674,6 @@ struct qeth_card_options {
 	struct qeth_ipa_info ipa6;
 	struct qeth_sbp_info sbp; /* SETBRIDGEPORT options */
 	int fake_broadcast;
-	int add_hhlen;
 	int layer2;
 	int performance_stats;
 	int rx_sg_cb;
drivers/s390/net/qeth_core_main.c +0 -2
index 639b92b..194f9d8 100644
@@ -55,7 +55,6 @@ static struct mutex qeth_mod_mutex;
 
 static void qeth_send_control_data_cb(struct qeth_channel *,
 			struct qeth_cmd_buffer *);
-static int qeth_issue_next_read(struct qeth_card *);
 static struct qeth_cmd_buffer *qeth_get_buffer(struct qeth_channel *);
 static void qeth_setup_ccw(struct qeth_channel *, unsigned char *, __u32);
 static void qeth_free_buffer_pool(struct qeth_card *);
@@ -1396,7 +1395,6 @@ static void qeth_set_intial_options(struct qeth_card *card)
 	card->options.route4.type = NO_ROUTER;
 	card->options.route6.type = NO_ROUTER;
 	card->options.fake_broadcast = 0;
-	card->options.add_hhlen = DEFAULT_ADD_HHLEN;
 	card->options.performance_stats = 0;
 	card->options.rx_sg_cb = QETH_RX_SG_CB;
 	card->options.isolation = ISOLATION_MODE_NONE;
drivers/s390/net/qeth_core_mpc.h +0 -17
index bc69d0a..4accb0a 100644
@@ -29,7 +29,6 @@ extern unsigned char IPA_PDU_HEADER[];
 #define QETH_TIMEOUT		(10 * HZ)
 #define QETH_IPA_TIMEOUT	(45 * HZ)
 #define QETH_IDX_COMMAND_SEQNO	0xffff0000
-#define SR_INFO_LEN		16
 
 #define QETH_CLEAR_CHANNEL_PARM	-10
 #define QETH_HALT_CHANNEL_PARM	-11
@@ -65,7 +64,6 @@ enum qeth_link_types {
 	QETH_LINK_TYPE_LANE_TR      = 0x82,
 	QETH_LINK_TYPE_LANE_ETH1000 = 0x83,
 	QETH_LINK_TYPE_LANE         = 0x88,
-	QETH_LINK_TYPE_ATM_NATIVE   = 0x90,
 };
 
 /*
@@ -185,8 +183,6 @@ enum qeth_ipa_return_codes {
 	IPA_RC_ENOMEM			= 0xfffe,
 	IPA_RC_FFFF			= 0xffff
 };
-/* for DELIP */
-#define IPA_RC_IP_ADDRESS_NOT_DEFINED	IPA_RC_PRIMARY_ALREADY_DEFINED
 /* for SET_DIAGNOSTIC_ASSIST */
 #define IPA_RC_INVALID_SUBCMD		IPA_RC_IP_TABLE_FULL
 #define IPA_RC_HARDWARE_AUTH_ERROR	IPA_RC_UNKNOWN_ERROR
@@ -631,14 +627,6 @@ enum qeth_ipa_addr_change_code {
 	IPA_ADDR_CHANGE_CODE_MACADDR		= 0x02,
 	IPA_ADDR_CHANGE_CODE_REMOVAL		= 0x80,	/* else addition */
 };
-enum qeth_ipa_addr_change_retcode {
-	IPA_ADDR_CHANGE_RETCODE_OK		= 0x0000,
-	IPA_ADDR_CHANGE_RETCODE_LOSTEVENTS	= 0x0010,
-};
-enum qeth_ipa_addr_change_lostmask {
-	IPA_ADDR_CHANGE_MASK_OVERFLOW		= 0x01,
-	IPA_ADDR_CHANGE_MASK_STATECHANGE	= 0x02,
-};
 
 struct qeth_ipacmd_addr_change_entry {
 	struct net_if_token token;
@@ -817,9 +805,4 @@ extern unsigned char IDX_ACTIVATE_WRITE[];
 	((buffer) && \
 	 (*(buffer + ((*(buffer + 0x0b)) + 4)) == 0xc1))
 
-#define ADDR_FRAME_TYPE_DIX 1
-#define ADDR_FRAME_TYPE_802_3 2
-#define ADDR_FRAME_TYPE_TR_WITHOUT_SR 0x10
-#define ADDR_FRAME_TYPE_TR_WITH_SR 0x20
-
 #endif
drivers/s390/net/qeth_l2_main.c +0 -1
index bea4833..5917982 100644
@@ -28,7 +28,6 @@
 static int qeth_l2_set_offline(struct ccwgroup_device *);
 static int qeth_l2_stop(struct net_device *);
 static void qeth_l2_set_rx_mode(struct net_device *);
-static int qeth_l2_recover(void *);
 static void qeth_bridgeport_query_support(struct qeth_card *card);
 static void qeth_bridge_state_change(struct qeth_card *card,
 					struct qeth_ipa_cmd *cmd);
drivers/s390/net/qeth_l2_sys.c +0 -3
index 692db49..6879723 100644
@@ -8,9 +8,6 @@
 #include "qeth_core.h"
 #include "qeth_l2.h"
 
-#define QETH_DEVICE_ATTR(_id, _name, _mode, _show, _store) \
-struct device_attribute dev_attr_##_id = __ATTR(_name, _mode, _show, _store)
-
 static ssize_t qeth_bridge_port_role_state_show(struct device *dev,
 				struct device_attribute *attr, char *buf,
 				int show_state)
drivers/s390/net/qeth_l3_main.c +0 -4
index 06d0add..8de5f74 100644
@@ -36,16 +36,12 @@
 
 
 static int qeth_l3_set_offline(struct ccwgroup_device *);
-static int qeth_l3_recover(void *);
 static int qeth_l3_stop(struct net_device *);
 static void qeth_l3_set_multicast_list(struct net_device *);
-static int qeth_l3_neigh_setup(struct net_device *, struct neigh_parms *);
 static int qeth_l3_register_addr_entry(struct qeth_card *,
 		struct qeth_ipaddr *);
 static int qeth_l3_deregister_addr_entry(struct qeth_card *,
 		struct qeth_ipaddr *);
-static int __qeth_l3_set_online(struct ccwgroup_device *, int);
-static int __qeth_l3_set_offline(struct ccwgroup_device *, int);
 
 static int qeth_l3_isxdigit(char *buf)
 {
Signature · 1 line
2.10.2
#5 lore raw

PATCH 5/7 s390/qeth: improve endianness handling

In reply to Ursula Braun

From: Hans Wippel <[email protected]>

Avoid endianness warnings reported by sparse by (1) using endianness conversions for assigning and using network packet fields, and (2) removing unnecessary endianness conversions from qeth_l3_rebuild_skb. No functional changes.

---
 drivers/s390/net/qeth_core.h      |  4 ++--
 drivers/s390/net/qeth_core_main.c | 11 +++++-----
 drivers/s390/net/qeth_l3_main.c   | 46 +++++++++++++++++++--------------------
 drivers/s390/net/qeth_l3_sys.c    |  4 ++--
 4 files changed, 33 insertions(+), 32 deletions(-)
drivers/s390/net/qeth_core.h +2 -2
index 22aa2cd..6764ab9 100644
@@ -844,9 +844,9 @@ static inline int qeth_get_ip_version(struct sk_buff *skb)
 {
 	__be16 *p = &((struct ethhdr *)skb->data)->h_proto;
 
-	if (*p == ETH_P_8021Q)
+	if (be16_to_cpu(*p) == ETH_P_8021Q)
 		p += 2;
-	switch (*p) {
+	switch (be16_to_cpu(*p)) {
 	case ETH_P_IPV6:
 		return 6;
 	case ETH_P_IP:
drivers/s390/net/qeth_core_main.c +6 -5
index 194f9d8..e76b764 100644
@@ -1201,7 +1201,7 @@ static void qeth_notify_skbs(struct qeth_qdio_out_q *q,
 	while (skb) {
 		QETH_CARD_TEXT_(q->card, 5, "skbn%d", notification);
 		QETH_CARD_TEXT_(q->card, 5, "%lx", (long) skb);
-		if (skb->protocol == ETH_P_AF_IUCV) {
+		if (be16_to_cpu(skb->protocol) == ETH_P_AF_IUCV) {
 			if (skb->sk) {
 				struct iucv_sock *iucv = iucv_sk(skb->sk);
 				iucv->sk_txnotify(skb, notification);
@@ -1232,7 +1232,8 @@ static void qeth_release_skbs(struct qeth_qdio_out_buffer *buf)
 	while (skb) {
 		QETH_CARD_TEXT(buf->q->card, 5, "skbr");
 		QETH_CARD_TEXT_(buf->q->card, 5, "%lx", (long) skb);
-		if (notify_general_error && skb->protocol == ETH_P_AF_IUCV) {
+		if (notify_general_error &&
+		    be16_to_cpu(skb->protocol) == ETH_P_AF_IUCV) {
 			if (skb->sk) {
 				iucv = iucv_sk(skb->sk);
 				iucv->sk_txnotify(skb, TX_NOTIFY_GENERALERROR);
@@ -3796,9 +3797,9 @@ int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb,
 		return qeth_cut_iqd_prio(card, ~skb->priority >> 1 & 3);
 	case QETH_PRIO_Q_ING_VLAN:
 		tci = &((struct ethhdr *)skb->data)->h_proto;
-		if (*tci == ETH_P_8021Q)
-			return qeth_cut_iqd_prio(card, ~*(tci + 1) >>
-			(VLAN_PRIO_SHIFT + 1) & 3);
+		if (be16_to_cpu(*tci) == ETH_P_8021Q)
+			return qeth_cut_iqd_prio(card,
+			~be16_to_cpu(*(tci + 1)) >> (VLAN_PRIO_SHIFT + 1) & 3);
 		break;
 	default:
 		break;
drivers/s390/net/qeth_l3_main.c +23 -23

146 lines not on this page · raw message

drivers/s390/net/qeth_l3_sys.c +2 -2
index 05e9471..ff29a4b 100644
@@ -286,7 +286,7 @@ static ssize_t qeth_l3_dev_hsuid_store(struct device *dev,
 		if (!addr)
 			return -ENOMEM;
 
-		addr->u.a6.addr.s6_addr32[0] = 0xfe800000;
+		addr->u.a6.addr.s6_addr32[0] = cpu_to_be32(0xfe800000);
 		addr->u.a6.addr.s6_addr32[1] = 0x00000000;
 		for (i = 8; i < 16; i++)
 			addr->u.a6.addr.s6_addr[i] =
@@ -320,7 +320,7 @@ static ssize_t qeth_l3_dev_hsuid_store(struct device *dev,
 
 	addr = qeth_l3_get_addr_buffer(QETH_PROT_IPV6);
 	if (addr != NULL) {
-		addr->u.a6.addr.s6_addr32[0] = 0xfe800000;
+		addr->u.a6.addr.s6_addr32[0] = cpu_to_be32(0xfe800000);
 		addr->u.a6.addr.s6_addr32[1] = 0x00000000;
 		for (i = 8; i < 16; i++)
 			addr->u.a6.addr.s6_addr[i] = card->options.hsuid[i - 8];
Signature · 1 line
2.10.2
#6 lore raw

RE: [PATCH net-next 5/7] s390/qeth: improve endianness handling

From: Ursula Braun

Quoted 22 lines

Sent: 05 April 2017 09:40
From: Hans Wippel <[email protected]>

Avoid endianness warnings reported by sparse by (1) using endianness conversions for assigning and using network packet fields, and (2) removing unnecessary endianness conversions from qeth_l3_rebuild_skb. No functional changes.

---
 drivers/s390/net/qeth_core.h      |  4 ++--
 drivers/s390/net/qeth_core_main.c | 11 +++++-----
 drivers/s390/net/qeth_l3_main.c   | 46 +++++++++++++++++++--------------------
 drivers/s390/net/qeth_l3_sys.c    |  4 ++--
 4 files changed, 33 insertions(+), 32 deletions(-)
drivers/s390/net/qeth_core.h +0 -0
index 22aa2cd..6764ab9 100644

drivers/s390/net/qeth_core.h static inline int qeth_get_ip_version(struct sk_buff *skb) · line 850

Quoted 9 lines
drivers/s390/net/qeth_core.h +2 -2
@@ -844,9 +844,9 @@ static inline int qeth_get_ip_version(struct sk_buff *skb)
 {
 	__be16 *p = &((struct ethhdr *)skb->data)->h_proto;
 
-	if (*p == ETH_P_8021Q)
+	if (be16_to_cpu(*p) == ETH_P_8021Q)
 		p += 2;
-	switch (*p) {
+	switch (be16_to_cpu(*p)) {
 	case ETH_P_IPV6:

These are definitely 'functional changes' on LE systems.

Also it is generally better to byteswap the constants.

David

#7 lore raw

Re: [PATCH net-next 5/7] s390/qeth: improve endianness handling

Quoted 26 lines · David Laight

From: Ursula Braun

Quoted 25 lines

Sent: 05 April 2017 09:40
From: Hans Wippel <[email protected]>

Avoid endianness warnings reported by sparse by (1) using endianness conversions for assigning and using network packet fields, and (2) removing unnecessary endianness conversions from qeth_l3_rebuild_skb. No functional changes.

---
 drivers/s390/net/qeth_core.h      |  4 ++--
 drivers/s390/net/qeth_core_main.c | 11 +++++-----
 drivers/s390/net/qeth_l3_main.c   | 46 +++++++++++++++++++--------------------
 drivers/s390/net/qeth_l3_sys.c    |  4 ++--
 4 files changed, 33 insertions(+), 32 deletions(-)
drivers/s390/net/qeth_core.h +0 -0
index 22aa2cd..6764ab9 100644
@@ -844,9 +844,9 @@ static inline int qeth_get_ip_version(struct sk_buff *skb)
 {
 	__be16 *p = &((struct ethhdr *)skb->data)->h_proto;
 
Quoted 8 lines

drivers/s390/net/qeth_core.h static inline int qeth_get_ip_version(struct sk_buff *skb) · line 850

Quoted 6 lines
drivers/s390/net/qeth_core.h +2 -2
-	if (*p == ETH_P_8021Q)
+	if (be16_to_cpu(*p) == ETH_P_8021Q)
 		p += 2;
-	switch (*p) {
+	switch (be16_to_cpu(*p)) {
 	case ETH_P_IPV6:

These are definitely 'functional changes' on LE systems.

s390 is Big Endian; thus the change is basicly a NOP. The only purpose of this kind of patches is getting rid of sparse warnings with our code.

Quoted 5 lines

Also it is generally better to byteswap the constants.

David

#8 lore raw

RE: [PATCH net-next 5/7] s390/qeth: improve endianness handling

From: Ursula Braun

Quoted 36 lines

Sent: 07 April 2017 13:33

Quoted 26 lines · David Laight

From: Ursula Braun

Quoted 25 lines

Sent: 05 April 2017 09:40
From: Hans Wippel <[email protected]>

Avoid endianness warnings reported by sparse by (1) using endianness conversions for assigning and using network packet fields, and (2) removing unnecessary endianness conversions from qeth_l3_rebuild_skb. No functional changes.

---
 drivers/s390/net/qeth_core.h      |  4 ++--
 drivers/s390/net/qeth_core_main.c | 11 +++++-----
 drivers/s390/net/qeth_l3_main.c   | 46 +++++++++++++++++++--------------------
 drivers/s390/net/qeth_l3_sys.c    |  4 ++--
 4 files changed, 33 insertions(+), 32 deletions(-)
drivers/s390/net/qeth_core.h +0 -0
index 22aa2cd..6764ab9 100644
@@ -844,9 +844,9 @@ static inline int qeth_get_ip_version(struct sk_buff *skb)
 {
 	__be16 *p = &((struct ethhdr *)skb->data)->h_proto;
 
Quoted 8 lines

drivers/s390/net/qeth_core.h static inline int qeth_get_ip_version(struct sk_buff *skb) · line 850

Quoted 6 lines
drivers/s390/net/qeth_core.h +2 -2
-	if (*p == ETH_P_8021Q)
+	if (be16_to_cpu(*p) == ETH_P_8021Q)
 		p += 2;
-	switch (*p) {
+	switch (be16_to_cpu(*p)) {
 	case ETH_P_IPV6:

These are definitely 'functional changes' on LE systems.

Quoted 4 lines

s390 is Big Endian; thus the change is basicly a NOP.

The only purpose of this kind of patches is getting rid of sparse warnings with our code.

Then say so in the commit message....

What you are really doing is fixing the code in case anyone tries to use it on a LE system.

David

#9 lore raw

Re: [PATCH net-next 5/7] s390/qeth: improve endianness handling

Quoted 37 lines · David Laight

From: Ursula Braun

Quoted 36 lines

Sent: 07 April 2017 13:33

Quoted 34 lines · David Laight

From: Ursula Braun

Quoted 22 lines

Sent: 05 April 2017 09:40
From: Hans Wippel <[email protected]>

Avoid endianness warnings reported by sparse by (1) using endianness conversions for assigning and using network packet fields, and (2) removing unnecessary endianness conversions from qeth_l3_rebuild_skb. No functional changes.

---
 drivers/s390/net/qeth_core.h      |  4 ++--
 drivers/s390/net/qeth_core_main.c | 11 +++++-----
 drivers/s390/net/qeth_l3_main.c   | 46 +++++++++++++++++++--------------------
 drivers/s390/net/qeth_l3_sys.c    |  4 ++--
 4 files changed, 33 insertions(+), 32 deletions(-)
drivers/s390/net/qeth_core.h +0 -0
index 22aa2cd..6764ab9 100644

drivers/s390/net/qeth_core.h static inline int qeth_get_ip_version(struct sk_buff *skb) · line 850

Quoted 9 lines
drivers/s390/net/qeth_core.h +2 -2
@@ -844,9 +844,9 @@ static inline int qeth_get_ip_version(struct sk_buff *skb)
 {
 	__be16 *p = &((struct ethhdr *)skb->data)->h_proto;
 
-	if (*p == ETH_P_8021Q)
+	if (be16_to_cpu(*p) == ETH_P_8021Q)
 		p += 2;
-	switch (*p) {
+	switch (be16_to_cpu(*p)) {
 	case ETH_P_IPV6:

These are definitely 'functional changes' on LE systems.

Quoted 6 lines
Quoted 4 lines

s390 is Big Endian; thus the change is basicly a NOP.

The only purpose of this kind of patches is getting rid of sparse warnings with our code.

Then say so in the commit message....

Understood, in future we will try to improve our commit message.

Quoted 6 lines

What you are really doing is fixing the code in case anyone tries to use it on a LE system.

David

#10 lore raw

PATCH 6/7 s390/ctcm: improve endianness handling

In reply to Ursula Braun

From: Hans Wippel <[email protected]>

Use endianness conversions for SKB protocol assignments and usage to avoid endianness warnings reported by sparse. No functional changes.

---
 drivers/s390/net/ctcm_fsms.c |  2 +-
 drivers/s390/net/ctcm_main.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/s390/net/ctcm_fsms.c +1 -1
index fd5944b..730d961 100644
@@ -1283,7 +1283,7 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg)
 		p_header = (struct pdu *)
 			(skb_tail_pointer(ch->trans_skb) - skb->len);
 		p_header->pdu_flag = 0x00;
-		if (skb->protocol == ntohs(ETH_P_SNAP))
+		if (be16_to_cpu(skb->protocol) == ETH_P_SNAP)
 			p_header->pdu_flag |= 0x60;
 		else
 			p_header->pdu_flag |= 0x20;
drivers/s390/net/ctcm_main.c +6 -6
index ac65f12..198842c 100644
@@ -106,7 +106,7 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb)
 			priv->stats.rx_frame_errors++;
 			return;
 		}
-		pskb->protocol = ntohs(header->type);
+		pskb->protocol = cpu_to_be16(header->type);
 		if ((header->length <= LL_HEADER_LENGTH) ||
 		    (len <= LL_HEADER_LENGTH)) {
 			if (!(ch->logflags & LOG_FLAG_ILLEGALSIZE)) {
@@ -125,7 +125,7 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb)
 		header->length -= LL_HEADER_LENGTH;
 		len -= LL_HEADER_LENGTH;
 		if ((header->length > skb_tailroom(pskb)) ||
-			(header->length > len)) {
+		    (header->length > len)) {
 			if (!(ch->logflags & LOG_FLAG_OVERRUN)) {
 				CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR,
 					"%s(%s): Packet size %d (overrun)"
@@ -485,7 +485,7 @@ static int ctcm_transmit_skb(struct channel *ch, struct sk_buff *skb)
 		} else {
 			atomic_inc(&skb->users);
 			header.length = l;
-			header.type = skb->protocol;
+			header.type = be16_to_cpu(skb->protocol);
 			header.unused = 0;
 			memcpy(skb_push(skb, LL_HEADER_LENGTH), &header,
 			       LL_HEADER_LENGTH);
@@ -503,7 +503,7 @@ static int ctcm_transmit_skb(struct channel *ch, struct sk_buff *skb)
 	atomic_inc(&skb->users);
 	ch->prof.txlen += skb->len;
 	header.length = skb->len + LL_HEADER_LENGTH;
-	header.type = skb->protocol;
+	header.type = be16_to_cpu(skb->protocol);
 	header.unused = 0;
 	memcpy(skb_push(skb, LL_HEADER_LENGTH), &header, LL_HEADER_LENGTH);
 	block_len = skb->len + 2;
@@ -690,7 +690,7 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb)
 		p_header->pdu_offset = skb->len;
 		p_header->pdu_proto = 0x01;
 		p_header->pdu_flag = 0x00;
-		if (skb->protocol == ntohs(ETH_P_SNAP)) {
+		if (be16_to_cpu(skb->protocol) == ETH_P_SNAP) {
 			p_header->pdu_flag |= PDU_FIRST | PDU_CNTL;
 		} else {
 			p_header->pdu_flag |= PDU_FIRST;
@@ -745,7 +745,7 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb)
 	p_header->pdu_proto = 0x01;
 	p_header->pdu_flag = 0x00;
 	p_header->pdu_seq = 0;
-	if (skb->protocol == ntohs(ETH_P_SNAP)) {
+	if (be16_to_cpu(skb->protocol) == ETH_P_SNAP) {
 		p_header->pdu_flag |= PDU_FIRST | PDU_CNTL;
 	} else {
 		p_header->pdu_flag |= PDU_FIRST;
Signature · 1 line
2.10.2
#11 lore raw

PATCH 7/7 s390/netiucv: improve endianness handling

In reply to Ursula Braun

From: Hans Wippel <[email protected]>

Replace ntohs with endianness conversion for the SKB protocol assignment to avoid an endianness warning reported by sparse. No functional change.

---
 drivers/s390/net/netiucv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/net/netiucv.c +1 -1
index 3f85b97..dba94b4 100644
@@ -635,7 +635,7 @@ static void netiucv_unpack_skb(struct iucv_connection *conn,
 	skb_put(pskb, NETIUCV_HDRLEN);
 	pskb->dev = dev;
 	pskb->ip_summed = CHECKSUM_NONE;
-	pskb->protocol = ntohs(ETH_P_IP);
+	pskb->protocol = cpu_to_be16(ETH_P_IP);
 
 	while (1) {
 		struct sk_buff *skb;
Signature · 1 line
2.10.2