s390/qeth: consolidate helpers for capability checking
authorJulian Wiedmann <jwi@linux.ibm.com>
Wed, 18 Dec 2019 16:34:49 +0000 (17:34 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Dec 2019 20:34:57 +0000 (12:34 -0800)
Convert the old code to use struct qeth_ipa_caps, and while at it remove
all unused helper macros.

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

index b54ef12840a2128dd05b8148798dd8935b05a6e3..6e16b19732f6ac952365d8f3a3753c01907853fa 100644 (file)
@@ -125,12 +125,6 @@ struct qeth_routing_info {
        enum qeth_routing_types type;
 };
 
-/* IPA stuff */
-struct qeth_ipa_info {
-       __u32 supported_funcs;
-       __u32 enabled_funcs;
-};
-
 /* SETBRIDGEPORT stuff */
 enum qeth_sbp_roles {
        QETH_SBP_ROLE_NONE      = 0,
@@ -169,41 +163,6 @@ struct qeth_vnicc_info {
        bool rx_bcast_enabled;
 };
 
-static inline int qeth_is_adp_supported(struct qeth_ipa_info *ipa,
-               enum qeth_ipa_setadp_cmd func)
-{
-       return (ipa->supported_funcs & func);
-}
-
-static inline int qeth_is_ipa_supported(struct qeth_ipa_info *ipa,
-               enum qeth_ipa_funcs func)
-{
-       return (ipa->supported_funcs & func);
-}
-
-static inline int qeth_is_ipa_enabled(struct qeth_ipa_info *ipa,
-               enum qeth_ipa_funcs func)
-{
-       return (ipa->supported_funcs & ipa->enabled_funcs & func);
-}
-
-#define qeth_adp_supported(c, f) \
-       qeth_is_adp_supported(&c->options.adp, f)
-#define qeth_is_supported(c, f) \
-       qeth_is_ipa_supported(&c->options.ipa4, f)
-#define qeth_is_enabled(c, f) \
-       qeth_is_ipa_enabled(&c->options.ipa4, f)
-#define qeth_is_supported6(c, f) \
-       qeth_is_ipa_supported(&c->options.ipa6, f)
-#define qeth_is_enabled6(c, f) \
-       qeth_is_ipa_enabled(&c->options.ipa6, f)
-#define qeth_is_ipafunc_supported(c, prot, f) \
-        ((prot == QETH_PROT_IPV6) ? \
-               qeth_is_supported6(c, f) : qeth_is_supported(c, f))
-#define qeth_is_ipafunc_enabled(c, prot, f) \
-        ((prot == QETH_PROT_IPV6) ? \
-               qeth_is_enabled6(c, f) : qeth_is_enabled(c, f))
-
 #define QETH_IDX_FUNC_LEVEL_OSD                 0x0101
 #define QETH_IDX_FUNC_LEVEL_IQD                 0x4108
 
@@ -735,11 +694,11 @@ enum qeth_discipline_id {
 };
 
 struct qeth_card_options {
+       struct qeth_ipa_caps ipa4;
+       struct qeth_ipa_caps ipa6;
        struct qeth_routing_info route4;
-       struct qeth_ipa_info ipa4;
-       struct qeth_ipa_info adp; /*Adapter parameters*/
        struct qeth_routing_info route6;
-       struct qeth_ipa_info ipa6;
+       struct qeth_ipa_caps adp; /* Adapter parameters */
        struct qeth_sbp_info sbp; /* SETBRIDGEPORT options */
        struct qeth_vnicc_info vnicc; /* VNICC options */
        int fake_broadcast;
index 38f3ed7567bc061ec1dfcbd66c59a04741026f34..6b55271091cb47d7df750eee1278e832d2977906 100644 (file)
@@ -2862,7 +2862,7 @@ static int qeth_query_setadapterparms_cb(struct qeth_card *card,
                      cmd->data.setadapterparms.data.query_cmds_supp.lan_type;
                QETH_CARD_TEXT_(card, 2, "lnk %d", card->info.link_type);
        }
-       card->options.adp.supported_funcs =
+       card->options.adp.supported =
                cmd->data.setadapterparms.data.query_cmds_supp.supported_cmds;
        return 0;
 }
@@ -2918,8 +2918,8 @@ static int qeth_query_ipassists_cb(struct qeth_card *card,
        case IPA_RC_NOTSUPP:
        case IPA_RC_L2_UNSUPPORTED_CMD:
                QETH_CARD_TEXT(card, 2, "ipaunsup");
-               card->options.ipa4.supported_funcs |= IPA_SETADAPTERPARMS;
-               card->options.ipa6.supported_funcs |= IPA_SETADAPTERPARMS;
+               card->options.ipa4.supported |= IPA_SETADAPTERPARMS;
+               card->options.ipa6.supported |= IPA_SETADAPTERPARMS;
                return -EOPNOTSUPP;
        default:
                QETH_DBF_MESSAGE(1, "IPA_CMD_QIPASSIST on device %x: Unhandled rc=%#x\n",
@@ -2927,13 +2927,11 @@ static int qeth_query_ipassists_cb(struct qeth_card *card,
                return -EIO;
        }
 
-       if (cmd->hdr.prot_version == QETH_PROT_IPV4) {
-               card->options.ipa4.supported_funcs = cmd->hdr.ipa_supported;
-               card->options.ipa4.enabled_funcs = cmd->hdr.ipa_enabled;
-       } else if (cmd->hdr.prot_version == QETH_PROT_IPV6) {
-               card->options.ipa6.supported_funcs = cmd->hdr.ipa_supported;
-               card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled;
-       } else
+       if (cmd->hdr.prot_version == QETH_PROT_IPV4)
+               card->options.ipa4 = cmd->hdr.assists;
+       else if (cmd->hdr.prot_version == QETH_PROT_IPV6)
+               card->options.ipa6 = cmd->hdr.assists;
+       else
                QETH_DBF_MESSAGE(1, "IPA_CMD_QIPASSIST on device %x: Flawed LIC detected\n",
                                 CARD_DEVID(card));
        return 0;
@@ -5002,9 +5000,9 @@ retriable:
                *carrier_ok = true;
        }
 
-       card->options.ipa4.supported_funcs = 0;
-       card->options.ipa6.supported_funcs = 0;
-       card->options.adp.supported_funcs = 0;
+       card->options.ipa4.supported = 0;
+       card->options.ipa6.supported = 0;
+       card->options.adp.supported = 0;
        card->options.sbp.supported_funcs = 0;
        card->info.diagass_support = 0;
        rc = qeth_query_ipassists(card, QETH_PROT_IPV4);
@@ -5421,9 +5419,9 @@ int qeth_setassparms_cb(struct qeth_card *card,
 
        cmd->hdr.return_code = cmd->data.setassparms.hdr.return_code;
        if (cmd->hdr.prot_version == QETH_PROT_IPV4)
-               card->options.ipa4.enabled_funcs = cmd->hdr.ipa_enabled;
+               card->options.ipa4.enabled = cmd->hdr.assists.enabled;
        if (cmd->hdr.prot_version == QETH_PROT_IPV6)
-               card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled;
+               card->options.ipa6.enabled = cmd->hdr.assists.enabled;
        return 0;
 }
 EXPORT_SYMBOL_GPL(qeth_setassparms_cb);
index f13225b4378193da7b35acccc6a488cc79f0e4d1..f4dc37e28ac7f9220338d6869f30377a9b9bb155 100644 (file)
@@ -53,6 +53,16 @@ static inline bool qeth_ipa_caps_enabled(struct qeth_ipa_caps *caps, u32 mask)
        return (caps->enabled & mask) == mask;
 }
 
+#define qeth_adp_supported(c, f) \
+       qeth_ipa_caps_supported(&c->options.adp, f)
+#define qeth_is_supported(c, f) \
+       qeth_ipa_caps_supported(&c->options.ipa4, f)
+#define qeth_is_supported6(c, f) \
+       qeth_ipa_caps_supported(&c->options.ipa6, f)
+#define qeth_is_ipafunc_supported(c, prot, f) \
+        ((prot == QETH_PROT_IPV6) ? qeth_is_supported6(c, f) : \
+                                    qeth_is_supported(c, f))
+
 enum qeth_card_types {
        QETH_CARD_TYPE_OSD     = 1,
        QETH_CARD_TYPE_IQD     = 5,
@@ -766,8 +776,7 @@ struct qeth_ipacmd_hdr {
        __u8   prim_version_no;
        __u8   param_count;
        __u16  prot_version;
-       __u32  ipa_supported;
-       __u32  ipa_enabled;
+       struct qeth_ipa_caps assists;
 } __attribute__ ((packed));
 
 /* The IPA command itself */