s390/qeth: clarify parameter for simple assist cmds
authorJulian Wiedmann <jwi@linux.ibm.com>
Thu, 27 Jun 2019 15:01:23 +0000 (17:01 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Jun 2019 17:18:23 +0000 (10:18 -0700)
For code that uses qeth_send_simple_setassparms_prot(), we currently
can't differentiate whether the cmd should contain (1) no parameter, or
(2) a 4-byte parameter with value 0.
At the moment this doesn't cause any trouble. But when using dynamically
allocated cmds, we need to know whether to allocate & transmit an
additional 4 bytes of zeroes.
So instead of the raw parameter value, pass a parameter pointer
(or NULL) to qeth_send_simple_setassparms_prot().

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_core.h
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_core_mpc.h
drivers/s390/net/qeth_l3_main.c

index 42aa4a2..35d7b43 100644 (file)
@@ -940,12 +940,12 @@ static inline int qeth_is_diagass_supported(struct qeth_card *card,
 
 int qeth_send_simple_setassparms_prot(struct qeth_card *card,
                                      enum qeth_ipa_funcs ipa_func,
-                                     u16 cmd_code, long data,
+                                     u16 cmd_code, u32 *data,
                                      enum qeth_prot_versions prot);
 /* IPv4 variant */
 static inline int qeth_send_simple_setassparms(struct qeth_card *card,
                                               enum qeth_ipa_funcs ipa_func,
-                                              u16 cmd_code, long data)
+                                              u16 cmd_code, u32 *data)
 {
        return qeth_send_simple_setassparms_prot(card, ipa_func, cmd_code,
                                                 data, QETH_PROT_IPV4);
@@ -953,7 +953,7 @@ static inline int qeth_send_simple_setassparms(struct qeth_card *card,
 
 static inline int qeth_send_simple_setassparms_v6(struct qeth_card *card,
                                                  enum qeth_ipa_funcs ipa_func,
-                                                 u16 cmd_code, long data)
+                                                 u16 cmd_code, u32 *data)
 {
        return qeth_send_simple_setassparms_prot(card, ipa_func, cmd_code,
                                                 data, QETH_PROT_IPV6);
index 84ed772..3ba91b1 100644 (file)
@@ -5355,20 +5355,19 @@ EXPORT_SYMBOL_GPL(qeth_get_setassparms_cmd);
 
 int qeth_send_simple_setassparms_prot(struct qeth_card *card,
                                      enum qeth_ipa_funcs ipa_func,
-                                     u16 cmd_code, long data,
+                                     u16 cmd_code, u32 *data,
                                      enum qeth_prot_versions prot)
 {
-       int length = 0;
+       unsigned int length = data ? SETASS_DATA_SIZEOF(flags_32bit) : 0;
        struct qeth_cmd_buffer *iob;
 
        QETH_CARD_TEXT_(card, 4, "simassp%i", prot);
-       if (data)
-               length = sizeof(__u32);
        iob = qeth_get_setassparms_cmd(card, ipa_func, cmd_code, length, prot);
        if (!iob)
                return -ENOMEM;
 
-       __ipa_cmd(iob)->data.setassparms.data.flags_32bit = (__u32) data;
+       if (data)
+               __ipa_cmd(iob)->data.setassparms.data.flags_32bit = *data;
        return qeth_send_ipa_cmd(card, iob, qeth_setassparms_cb, NULL);
 }
 EXPORT_SYMBOL_GPL(qeth_send_simple_setassparms_prot);
@@ -5885,8 +5884,8 @@ static int qeth_start_csum_cb(struct qeth_card *card, struct qeth_reply *reply,
 static int qeth_set_csum_off(struct qeth_card *card, enum qeth_ipa_funcs cstype,
                             enum qeth_prot_versions prot)
 {
-       return qeth_send_simple_setassparms_prot(card, cstype,
-                                                IPA_CMD_ASS_STOP, 0, prot);
+       return qeth_send_simple_setassparms_prot(card, cstype, IPA_CMD_ASS_STOP,
+                                                NULL, prot);
 }
 
 static int qeth_set_csum_on(struct qeth_card *card, enum qeth_ipa_funcs cstype,
@@ -5974,7 +5973,7 @@ static int qeth_set_tso_off(struct qeth_card *card,
                            enum qeth_prot_versions prot)
 {
        return qeth_send_simple_setassparms_prot(card, IPA_OUTBOUND_TSO,
-                                                IPA_CMD_ASS_STOP, 0, prot);
+                                                IPA_CMD_ASS_STOP, NULL, prot);
 }
 
 static int qeth_set_tso_on(struct qeth_card *card,
index e84249f..61fc400 100644 (file)
@@ -437,6 +437,8 @@ struct qeth_ipacmd_setassparms {
        } data;
 } __attribute__ ((packed));
 
+#define SETASS_DATA_SIZEOF(field) FIELD_SIZEOF(struct qeth_ipacmd_setassparms,\
+                                              data.field)
 
 /* SETRTG IPA Command:    ****************************************************/
 struct qeth_set_routing {
index 81312be..3de71ed 100644 (file)
@@ -770,7 +770,7 @@ static int qeth_l3_start_ipa_arp_processing(struct qeth_card *card)
                return 0;
        }
        rc = qeth_send_simple_setassparms(card, IPA_ARP_PROCESSING,
-                                         IPA_CMD_ASS_START, 0);
+                                         IPA_CMD_ASS_START, NULL);
        if (rc) {
                dev_warn(&card->gdev->dev,
                        "Starting ARP processing support for %s failed\n",
@@ -793,7 +793,7 @@ static int qeth_l3_start_ipa_source_mac(struct qeth_card *card)
        }
 
        rc = qeth_send_simple_setassparms(card, IPA_SOURCE_MAC,
-                                         IPA_CMD_ASS_START, 0);
+                                         IPA_CMD_ASS_START, NULL);
        if (rc)
                dev_warn(&card->gdev->dev,
                        "Starting source MAC-address support for %s failed\n",
@@ -814,7 +814,7 @@ static int qeth_l3_start_ipa_vlan(struct qeth_card *card)
        }
 
        rc = qeth_send_simple_setassparms(card, IPA_VLAN_PRIO,
-                                         IPA_CMD_ASS_START, 0);
+                                         IPA_CMD_ASS_START, NULL);
        if (rc) {
                dev_warn(&card->gdev->dev,
                        "Starting VLAN support for %s failed\n",
@@ -839,7 +839,7 @@ static int qeth_l3_start_ipa_multicast(struct qeth_card *card)
        }
 
        rc = qeth_send_simple_setassparms(card, IPA_MULTICASTING,
-                                         IPA_CMD_ASS_START, 0);
+                                         IPA_CMD_ASS_START, NULL);
        if (rc) {
                dev_warn(&card->gdev->dev,
                        "Starting multicast support for %s failed\n",
@@ -853,6 +853,7 @@ static int qeth_l3_start_ipa_multicast(struct qeth_card *card)
 
 static int qeth_l3_softsetup_ipv6(struct qeth_card *card)
 {
+       u32 ipv6_data = 3;
        int rc;
 
        QETH_CARD_TEXT(card, 3, "softipv6");
@@ -860,16 +861,16 @@ static int qeth_l3_softsetup_ipv6(struct qeth_card *card)
        if (IS_IQD(card))
                goto out;
 
-       rc = qeth_send_simple_setassparms(card, IPA_IPV6,
-                                         IPA_CMD_ASS_START, 3);
+       rc = qeth_send_simple_setassparms(card, IPA_IPV6, IPA_CMD_ASS_START,
+                                         &ipv6_data);
        if (rc) {
                dev_err(&card->gdev->dev,
                        "Activating IPv6 support for %s failed\n",
                        QETH_CARD_IFNAME(card));
                return rc;
        }
-       rc = qeth_send_simple_setassparms_v6(card, IPA_IPV6,
-                                            IPA_CMD_ASS_START, 0);
+       rc = qeth_send_simple_setassparms_v6(card, IPA_IPV6, IPA_CMD_ASS_START,
+                                            NULL);
        if (rc) {
                dev_err(&card->gdev->dev,
                        "Activating IPv6 support for %s failed\n",
@@ -877,7 +878,7 @@ static int qeth_l3_softsetup_ipv6(struct qeth_card *card)
                return rc;
        }
        rc = qeth_send_simple_setassparms_v6(card, IPA_PASSTHRU,
-                                            IPA_CMD_ASS_START, 0);
+                                            IPA_CMD_ASS_START, NULL);
        if (rc) {
                dev_warn(&card->gdev->dev,
                        "Enabling the passthrough mode for %s failed\n",
@@ -903,6 +904,7 @@ static int qeth_l3_start_ipa_ipv6(struct qeth_card *card)
 
 static int qeth_l3_start_ipa_broadcast(struct qeth_card *card)
 {
+       u32 filter_data = 1;
        int rc;
 
        QETH_CARD_TEXT(card, 3, "stbrdcst");
@@ -915,7 +917,7 @@ static int qeth_l3_start_ipa_broadcast(struct qeth_card *card)
                goto out;
        }
        rc = qeth_send_simple_setassparms(card, IPA_FILTERING,
-                                         IPA_CMD_ASS_START, 0);
+                                         IPA_CMD_ASS_START, NULL);
        if (rc) {
                dev_warn(&card->gdev->dev, "Enabling broadcast filtering for "
                        "%s failed\n", QETH_CARD_IFNAME(card));
@@ -923,7 +925,7 @@ static int qeth_l3_start_ipa_broadcast(struct qeth_card *card)
        }
 
        rc = qeth_send_simple_setassparms(card, IPA_FILTERING,
-                                         IPA_CMD_ASS_CONFIGURE, 1);
+                                         IPA_CMD_ASS_CONFIGURE, &filter_data);
        if (rc) {
                dev_warn(&card->gdev->dev,
                        "Setting up broadcast filtering for %s failed\n",
@@ -933,7 +935,7 @@ static int qeth_l3_start_ipa_broadcast(struct qeth_card *card)
        card->info.broadcast_capable = QETH_BROADCAST_WITH_ECHO;
        dev_info(&card->gdev->dev, "Broadcast enabled\n");
        rc = qeth_send_simple_setassparms(card, IPA_FILTERING,
-                                         IPA_CMD_ASS_ENABLE, 1);
+                                         IPA_CMD_ASS_ENABLE, &filter_data);
        if (rc) {
                dev_warn(&card->gdev->dev, "Setting up broadcast echo "
                        "filtering for %s failed\n", QETH_CARD_IFNAME(card));