Commit 52f82bf1 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: consolidate helpers for capability checking

Convert the old code to use struct qeth_ipa_caps, and while at it remove
all unused helper macros.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent adee2592
...@@ -125,12 +125,6 @@ struct qeth_routing_info { ...@@ -125,12 +125,6 @@ struct qeth_routing_info {
enum qeth_routing_types type; enum qeth_routing_types type;
}; };
/* IPA stuff */
struct qeth_ipa_info {
__u32 supported_funcs;
__u32 enabled_funcs;
};
/* SETBRIDGEPORT stuff */ /* SETBRIDGEPORT stuff */
enum qeth_sbp_roles { enum qeth_sbp_roles {
QETH_SBP_ROLE_NONE = 0, QETH_SBP_ROLE_NONE = 0,
...@@ -169,41 +163,6 @@ struct qeth_vnicc_info { ...@@ -169,41 +163,6 @@ struct qeth_vnicc_info {
bool rx_bcast_enabled; 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_OSD 0x0101
#define QETH_IDX_FUNC_LEVEL_IQD 0x4108 #define QETH_IDX_FUNC_LEVEL_IQD 0x4108
...@@ -735,11 +694,11 @@ enum qeth_discipline_id { ...@@ -735,11 +694,11 @@ enum qeth_discipline_id {
}; };
struct qeth_card_options { struct qeth_card_options {
struct qeth_ipa_caps ipa4;
struct qeth_ipa_caps ipa6;
struct qeth_routing_info route4; struct qeth_routing_info route4;
struct qeth_ipa_info ipa4;
struct qeth_ipa_info adp; /*Adapter parameters*/
struct qeth_routing_info route6; 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_sbp_info sbp; /* SETBRIDGEPORT options */
struct qeth_vnicc_info vnicc; /* VNICC options */ struct qeth_vnicc_info vnicc; /* VNICC options */
int fake_broadcast; int fake_broadcast;
......
...@@ -2862,7 +2862,7 @@ static int qeth_query_setadapterparms_cb(struct qeth_card *card, ...@@ -2862,7 +2862,7 @@ static int qeth_query_setadapterparms_cb(struct qeth_card *card,
cmd->data.setadapterparms.data.query_cmds_supp.lan_type; cmd->data.setadapterparms.data.query_cmds_supp.lan_type;
QETH_CARD_TEXT_(card, 2, "lnk %d", card->info.link_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; cmd->data.setadapterparms.data.query_cmds_supp.supported_cmds;
return 0; return 0;
} }
...@@ -2918,8 +2918,8 @@ static int qeth_query_ipassists_cb(struct qeth_card *card, ...@@ -2918,8 +2918,8 @@ static int qeth_query_ipassists_cb(struct qeth_card *card,
case IPA_RC_NOTSUPP: case IPA_RC_NOTSUPP:
case IPA_RC_L2_UNSUPPORTED_CMD: case IPA_RC_L2_UNSUPPORTED_CMD:
QETH_CARD_TEXT(card, 2, "ipaunsup"); QETH_CARD_TEXT(card, 2, "ipaunsup");
card->options.ipa4.supported_funcs |= IPA_SETADAPTERPARMS; card->options.ipa4.supported |= IPA_SETADAPTERPARMS;
card->options.ipa6.supported_funcs |= IPA_SETADAPTERPARMS; card->options.ipa6.supported |= IPA_SETADAPTERPARMS;
return -EOPNOTSUPP; return -EOPNOTSUPP;
default: default:
QETH_DBF_MESSAGE(1, "IPA_CMD_QIPASSIST on device %x: Unhandled rc=%#x\n", 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, ...@@ -2927,13 +2927,11 @@ static int qeth_query_ipassists_cb(struct qeth_card *card,
return -EIO; return -EIO;
} }
if (cmd->hdr.prot_version == QETH_PROT_IPV4) { if (cmd->hdr.prot_version == QETH_PROT_IPV4)
card->options.ipa4.supported_funcs = cmd->hdr.ipa_supported; card->options.ipa4 = cmd->hdr.assists;
card->options.ipa4.enabled_funcs = cmd->hdr.ipa_enabled; else if (cmd->hdr.prot_version == QETH_PROT_IPV6)
} else if (cmd->hdr.prot_version == QETH_PROT_IPV6) { card->options.ipa6 = cmd->hdr.assists;
card->options.ipa6.supported_funcs = cmd->hdr.ipa_supported; else
card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled;
} else
QETH_DBF_MESSAGE(1, "IPA_CMD_QIPASSIST on device %x: Flawed LIC detected\n", QETH_DBF_MESSAGE(1, "IPA_CMD_QIPASSIST on device %x: Flawed LIC detected\n",
CARD_DEVID(card)); CARD_DEVID(card));
return 0; return 0;
...@@ -5002,9 +5000,9 @@ int qeth_core_hardsetup_card(struct qeth_card *card, bool *carrier_ok) ...@@ -5002,9 +5000,9 @@ int qeth_core_hardsetup_card(struct qeth_card *card, bool *carrier_ok)
*carrier_ok = true; *carrier_ok = true;
} }
card->options.ipa4.supported_funcs = 0; card->options.ipa4.supported = 0;
card->options.ipa6.supported_funcs = 0; card->options.ipa6.supported = 0;
card->options.adp.supported_funcs = 0; card->options.adp.supported = 0;
card->options.sbp.supported_funcs = 0; card->options.sbp.supported_funcs = 0;
card->info.diagass_support = 0; card->info.diagass_support = 0;
rc = qeth_query_ipassists(card, QETH_PROT_IPV4); rc = qeth_query_ipassists(card, QETH_PROT_IPV4);
...@@ -5421,9 +5419,9 @@ int qeth_setassparms_cb(struct qeth_card *card, ...@@ -5421,9 +5419,9 @@ int qeth_setassparms_cb(struct qeth_card *card,
cmd->hdr.return_code = cmd->data.setassparms.hdr.return_code; cmd->hdr.return_code = cmd->data.setassparms.hdr.return_code;
if (cmd->hdr.prot_version == QETH_PROT_IPV4) 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) 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; return 0;
} }
EXPORT_SYMBOL_GPL(qeth_setassparms_cb); EXPORT_SYMBOL_GPL(qeth_setassparms_cb);
......
...@@ -53,6 +53,16 @@ static inline bool qeth_ipa_caps_enabled(struct qeth_ipa_caps *caps, u32 mask) ...@@ -53,6 +53,16 @@ static inline bool qeth_ipa_caps_enabled(struct qeth_ipa_caps *caps, u32 mask)
return (caps->enabled & mask) == 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 { enum qeth_card_types {
QETH_CARD_TYPE_OSD = 1, QETH_CARD_TYPE_OSD = 1,
QETH_CARD_TYPE_IQD = 5, QETH_CARD_TYPE_IQD = 5,
...@@ -766,8 +776,7 @@ struct qeth_ipacmd_hdr { ...@@ -766,8 +776,7 @@ struct qeth_ipacmd_hdr {
__u8 prim_version_no; __u8 prim_version_no;
__u8 param_count; __u8 param_count;
__u16 prot_version; __u16 prot_version;
__u32 ipa_supported; struct qeth_ipa_caps assists;
__u32 ipa_enabled;
} __attribute__ ((packed)); } __attribute__ ((packed));
/* The IPA command itself */ /* The IPA command itself */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment