aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorStefan Raspl <raspl@linux.vnet.ibm.com>2014-07-21 06:54:43 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-21 23:21:40 -0400
commit45cbb2e499cf4686e809206b29377a7e15037bcc (patch)
treea2558379f282fde09a35eed7c3da437cb839eed8 /drivers/s390
parent240524089d7a5c0396656574e299beb3a55461e3 (diff)
qeth: Display adjacent switch attributes
Add support to display the adjacent switch port's forwarding attributes. Currently supports info on forwarding modes '802.1' and 'rr' (reflective relay). Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com> Reviewed-by: Ursula Braun <ursula.braun@de.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/net/qeth_core.h7
-rw-r--r--drivers/s390/net/qeth_core_main.c39
-rw-r--r--drivers/s390/net/qeth_core_mpc.h17
-rw-r--r--drivers/s390/net/qeth_core_sys.c38
4 files changed, 100 insertions, 1 deletions
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index a2088af51cc5..bbafbd0e017a 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -766,6 +766,11 @@ struct carrier_info {
766 __u32 port_speed; 766 __u32 port_speed;
767}; 767};
768 768
769struct qeth_switch_info {
770 __u32 capabilities;
771 __u32 settings;
772};
773
769#define QETH_NAPI_WEIGHT NAPI_POLL_WEIGHT 774#define QETH_NAPI_WEIGHT NAPI_POLL_WEIGHT
770 775
771struct qeth_card { 776struct qeth_card {
@@ -946,6 +951,8 @@ struct qeth_cmd_buffer *qeth_wait_for_buffer(struct qeth_channel *);
946int qeth_mdio_read(struct net_device *, int, int); 951int qeth_mdio_read(struct net_device *, int, int);
947int qeth_snmp_command(struct qeth_card *, char __user *); 952int qeth_snmp_command(struct qeth_card *, char __user *);
948int qeth_query_oat_command(struct qeth_card *, char __user *); 953int qeth_query_oat_command(struct qeth_card *, char __user *);
954int qeth_query_switch_attributes(struct qeth_card *card,
955 struct qeth_switch_info *sw_info);
949int qeth_query_card_info(struct qeth_card *card, 956int qeth_query_card_info(struct qeth_card *card,
950 struct carrier_info *carrier_info); 957 struct carrier_info *carrier_info);
951int qeth_send_control_data(struct qeth_card *, int, struct qeth_cmd_buffer *, 958int qeth_send_control_data(struct qeth_card *, int, struct qeth_cmd_buffer *,
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index f54bec54d677..71bfacfc097e 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -3037,6 +3037,45 @@ int qeth_query_ipassists(struct qeth_card *card, enum qeth_prot_versions prot)
3037} 3037}
3038EXPORT_SYMBOL_GPL(qeth_query_ipassists); 3038EXPORT_SYMBOL_GPL(qeth_query_ipassists);
3039 3039
3040static int qeth_query_switch_attributes_cb(struct qeth_card *card,
3041 struct qeth_reply *reply, unsigned long data)
3042{
3043 struct qeth_ipa_cmd *cmd;
3044 struct qeth_switch_info *sw_info;
3045 struct qeth_query_switch_attributes *attrs;
3046
3047 QETH_CARD_TEXT(card, 2, "qswiatcb");
3048 cmd = (struct qeth_ipa_cmd *) data;
3049 sw_info = (struct qeth_switch_info *)reply->param;
3050 if (cmd->data.setadapterparms.hdr.return_code == 0) {
3051 attrs = &cmd->data.setadapterparms.data.query_switch_attributes;
3052 sw_info->capabilities = attrs->capabilities;
3053 sw_info->settings = attrs->settings;
3054 QETH_CARD_TEXT_(card, 2, "%04x%04x", sw_info->capabilities,
3055 sw_info->settings);
3056 }
3057 qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd);
3058
3059 return 0;
3060}
3061
3062int qeth_query_switch_attributes(struct qeth_card *card,
3063 struct qeth_switch_info *sw_info)
3064{
3065 struct qeth_cmd_buffer *iob;
3066
3067 QETH_CARD_TEXT(card, 2, "qswiattr");
3068 if (!qeth_adp_supported(card, IPA_SETADP_QUERY_SWITCH_ATTRIBUTES))
3069 return -EOPNOTSUPP;
3070 if (!netif_carrier_ok(card->dev))
3071 return -ENOMEDIUM;
3072 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_SWITCH_ATTRIBUTES,
3073 sizeof(struct qeth_ipacmd_setadpparms_hdr));
3074 return qeth_send_ipa_cmd(card, iob,
3075 qeth_query_switch_attributes_cb, sw_info);
3076}
3077EXPORT_SYMBOL_GPL(qeth_query_switch_attributes);
3078
3040static int qeth_query_setdiagass_cb(struct qeth_card *card, 3079static int qeth_query_setdiagass_cb(struct qeth_card *card,
3041 struct qeth_reply *reply, unsigned long data) 3080 struct qeth_reply *reply, unsigned long data)
3042{ 3081{
diff --git a/drivers/s390/net/qeth_core_mpc.h b/drivers/s390/net/qeth_core_mpc.h
index cf6a90ed42ae..1558be1af72d 100644
--- a/drivers/s390/net/qeth_core_mpc.h
+++ b/drivers/s390/net/qeth_core_mpc.h
@@ -242,6 +242,7 @@ enum qeth_ipa_setadp_cmd {
242 IPA_SETADP_SET_DIAG_ASSIST = 0x00002000L, 242 IPA_SETADP_SET_DIAG_ASSIST = 0x00002000L,
243 IPA_SETADP_SET_ACCESS_CONTROL = 0x00010000L, 243 IPA_SETADP_SET_ACCESS_CONTROL = 0x00010000L,
244 IPA_SETADP_QUERY_OAT = 0x00080000L, 244 IPA_SETADP_QUERY_OAT = 0x00080000L,
245 IPA_SETADP_QUERY_SWITCH_ATTRIBUTES = 0x00100000L,
245}; 246};
246enum qeth_ipa_mac_ops { 247enum qeth_ipa_mac_ops {
247 CHANGE_ADDR_READ_MAC = 0, 248 CHANGE_ADDR_READ_MAC = 0,
@@ -431,6 +432,21 @@ struct qeth_query_card_info {
431 __u32 reserved2; 432 __u32 reserved2;
432}; 433};
433 434
435#define QETH_SWITCH_FORW_802_1 0x00000001
436#define QETH_SWITCH_FORW_REFL_RELAY 0x00000002
437#define QETH_SWITCH_CAP_RTE 0x00000004
438#define QETH_SWITCH_CAP_ECP 0x00000008
439#define QETH_SWITCH_CAP_VDP 0x00000010
440
441struct qeth_query_switch_attributes {
442 __u8 version;
443 __u8 reserved1;
444 __u16 reserved2;
445 __u32 capabilities;
446 __u32 settings;
447 __u8 reserved3[8];
448};
449
434struct qeth_ipacmd_setadpparms_hdr { 450struct qeth_ipacmd_setadpparms_hdr {
435 __u32 supp_hw_cmds; 451 __u32 supp_hw_cmds;
436 __u32 reserved1; 452 __u32 reserved1;
@@ -452,6 +468,7 @@ struct qeth_ipacmd_setadpparms {
452 struct qeth_set_access_ctrl set_access_ctrl; 468 struct qeth_set_access_ctrl set_access_ctrl;
453 struct qeth_query_oat query_oat; 469 struct qeth_query_oat query_oat;
454 struct qeth_query_card_info card_info; 470 struct qeth_query_card_info card_info;
471 struct qeth_query_switch_attributes query_switch_attributes;
455 __u32 mode; 472 __u32 mode;
456 } data; 473 } data;
457} __attribute__ ((packed)); 474} __attribute__ ((packed));
diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c
index 8a25a2be9890..15523f0e4c03 100644
--- a/drivers/s390/net/qeth_core_sys.c
+++ b/drivers/s390/net/qeth_core_sys.c
@@ -543,7 +543,42 @@ out:
543} 543}
544 544
545static DEVICE_ATTR(isolation, 0644, qeth_dev_isolation_show, 545static DEVICE_ATTR(isolation, 0644, qeth_dev_isolation_show,
546 qeth_dev_isolation_store); 546 qeth_dev_isolation_store);
547
548static ssize_t qeth_dev_switch_attrs_show(struct device *dev,
549 struct device_attribute *attr, char *buf)
550{
551 struct qeth_card *card = dev_get_drvdata(dev);
552 struct qeth_switch_info sw_info;
553 int rc = 0;
554
555 if (!card)
556 return -EINVAL;
557
558 if (card->state != CARD_STATE_SOFTSETUP && card->state != CARD_STATE_UP)
559 return sprintf(buf, "n/a\n");
560
561 rc = qeth_query_switch_attributes(card, &sw_info);
562 if (rc)
563 return rc;
564
565 if (!sw_info.capabilities)
566 rc = sprintf(buf, "unknown");
567
568 if (sw_info.capabilities & QETH_SWITCH_FORW_802_1)
569 rc = sprintf(buf, (sw_info.settings & QETH_SWITCH_FORW_802_1 ?
570 "[802.1]" : "802.1"));
571 if (sw_info.capabilities & QETH_SWITCH_FORW_REFL_RELAY)
572 rc += sprintf(buf + rc,
573 (sw_info.settings & QETH_SWITCH_FORW_REFL_RELAY ?
574 " [rr]" : " rr"));
575 rc += sprintf(buf + rc, "\n");
576
577 return rc;
578}
579
580static DEVICE_ATTR(switch_attrs, 0444,
581 qeth_dev_switch_attrs_show, NULL);
547 582
548static ssize_t qeth_hw_trap_show(struct device *dev, 583static ssize_t qeth_hw_trap_show(struct device *dev,
549 struct device_attribute *attr, char *buf) 584 struct device_attribute *attr, char *buf)
@@ -728,6 +763,7 @@ static struct attribute *qeth_device_attrs[] = {
728 &dev_attr_layer2.attr, 763 &dev_attr_layer2.attr,
729 &dev_attr_isolation.attr, 764 &dev_attr_isolation.attr,
730 &dev_attr_hw_trap.attr, 765 &dev_attr_hw_trap.attr,
766 &dev_attr_switch_attrs.attr,
731 NULL, 767 NULL,
732}; 768};
733static struct attribute_group qeth_device_attr_group = { 769static struct attribute_group qeth_device_attr_group = {