Skip to content

Commit b4d72c0

Browse files
Eugene Crosserdavem330
authored andcommitted
qeth: bridgeport support - basic control
Introduce functions to assign roles and check state of bridgeport-capable HiperSocket devices, and sysfs attributes providing access to these functions from userspace. Introduce udev events emitted when the state of a bridgeport device changes. Signed-off-by: Eugene Crosser <eugene.crosser@ru.ibm.com> Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com> Reviewed-by: Ursula Braun <ursula.braun@de.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3977458 commit b4d72c0

File tree

9 files changed

+685
-2
lines changed

9 files changed

+685
-2
lines changed

Documentation/s390/qeth.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
IBM s390 QDIO Ethernet Driver
2+
3+
HiperSockets Bridge Port Support
4+
5+
Uevents
6+
7+
To generate the events the device must be assigned a role of either
8+
a primary or a secondary Bridge Port. For more information, see
9+
"z/VM Connectivity, SC24-6174".
10+
11+
When run on HiperSockets Bridge Capable Port hardware, and the state
12+
of some configured Bridge Port device on the channel changes, a udev
13+
event with ACTION=CHANGE is emitted on behalf of the corresponding
14+
ccwgroup device. The event has the following attributes:
15+
16+
BRIDGEPORT=statechange - indicates that the Bridge Port device changed
17+
its state.
18+
19+
ROLE={primary|secondary|none} - the role assigned to the port.
20+
21+
STATE={active|standby|inactive} - the newly assumed state of the port.

drivers/s390/net/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ obj-$(CONFIG_LCS) += lcs.o
1111
obj-$(CONFIG_CLAW) += claw.o
1212
qeth-y += qeth_core_sys.o qeth_core_main.o qeth_core_mpc.o
1313
obj-$(CONFIG_QETH) += qeth.o
14-
qeth_l2-y += qeth_l2_main.o
14+
qeth_l2-y += qeth_l2_main.o qeth_l2_sys.o
1515
obj-$(CONFIG_QETH_L2) += qeth_l2.o
1616
qeth_l3-y += qeth_l3_main.o qeth_l3_sys.o
1717
obj-$(CONFIG_QETH_L3) += qeth_l3.o

drivers/s390/net/qeth_core.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,24 @@ struct qeth_ipa_info {
156156
__u32 enabled_funcs;
157157
};
158158

159+
/* SETBRIDGEPORT stuff */
160+
enum qeth_sbp_roles {
161+
QETH_SBP_ROLE_NONE = 0,
162+
QETH_SBP_ROLE_PRIMARY = 1,
163+
QETH_SBP_ROLE_SECONDARY = 2,
164+
};
165+
166+
enum qeth_sbp_states {
167+
QETH_SBP_STATE_INACTIVE = 0,
168+
QETH_SBP_STATE_STANDBY = 1,
169+
QETH_SBP_STATE_ACTIVE = 2,
170+
};
171+
172+
struct qeth_sbp_info {
173+
__u32 supported_funcs;
174+
enum qeth_sbp_roles role;
175+
};
176+
159177
static inline int qeth_is_ipa_supported(struct qeth_ipa_info *ipa,
160178
enum qeth_ipa_funcs func)
161179
{
@@ -672,6 +690,7 @@ struct qeth_card_options {
672690
struct qeth_ipa_info adp; /*Adapter parameters*/
673691
struct qeth_routing_info route6;
674692
struct qeth_ipa_info ipa6;
693+
struct qeth_sbp_info sbp; /* SETBRIDGEPORT options */
675694
int fake_broadcast;
676695
int add_hhlen;
677696
int layer2;
@@ -857,6 +876,7 @@ extern struct qeth_discipline qeth_l2_discipline;
857876
extern struct qeth_discipline qeth_l3_discipline;
858877
extern const struct attribute_group *qeth_generic_attr_groups[];
859878
extern const struct attribute_group *qeth_osn_attr_groups[];
879+
extern struct workqueue_struct *qeth_wq;
860880

861881
const char *qeth_get_cardname_short(struct qeth_card *);
862882
int qeth_realloc_buffer_pool(struct qeth_card *, int);
@@ -925,6 +945,11 @@ int qeth_query_card_info(struct qeth_card *card,
925945
int qeth_send_control_data(struct qeth_card *, int, struct qeth_cmd_buffer *,
926946
int (*reply_cb)(struct qeth_card *, struct qeth_reply*, unsigned long),
927947
void *reply_param);
948+
void qeth_bridge_state_change(struct qeth_card *card, struct qeth_ipa_cmd *cmd);
949+
void qeth_bridgeport_query_support(struct qeth_card *card);
950+
int qeth_bridgeport_query_ports(struct qeth_card *card,
951+
enum qeth_sbp_roles *role, enum qeth_sbp_states *state);
952+
int qeth_bridgeport_setrole(struct qeth_card *card, enum qeth_sbp_roles role);
928953
int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int);
929954
int qeth_get_elements_no(struct qeth_card *, struct sk_buff *, int);
930955
int qeth_get_elements_for_frags(struct sk_buff *);

drivers/s390/net/qeth_core_main.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,
6868
enum qeth_qdio_buffer_states newbufstate);
6969
static int qeth_init_qdio_out_buf(struct qeth_qdio_out_q *, int);
7070

71-
static struct workqueue_struct *qeth_wq;
71+
struct workqueue_struct *qeth_wq;
7272

7373
static void qeth_close_dev_handler(struct work_struct *work)
7474
{
@@ -615,6 +615,13 @@ static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card,
615615
card->info.hwtrap = 2;
616616
qeth_schedule_recovery(card);
617617
return NULL;
618+
case IPA_CMD_SETBRIDGEPORT:
619+
if (cmd->data.sbp.hdr.command_code ==
620+
IPA_SBP_BRIDGE_PORT_STATE_CHANGE) {
621+
qeth_bridge_state_change(card, cmd);
622+
return NULL;
623+
} else
624+
return cmd;
618625
case IPA_CMD_MODCCID:
619626
return cmd;
620627
case IPA_CMD_REGISTER_LOCAL_ADDR:
@@ -4956,12 +4963,17 @@ int qeth_core_hardsetup_card(struct qeth_card *card)
49564963

49574964
card->options.ipa4.supported_funcs = 0;
49584965
card->options.adp.supported_funcs = 0;
4966+
card->options.sbp.supported_funcs = 0;
49594967
card->info.diagass_support = 0;
49604968
qeth_query_ipassists(card, QETH_PROT_IPV4);
49614969
if (qeth_is_supported(card, IPA_SETADAPTERPARMS))
49624970
qeth_query_setadapterparms(card);
49634971
if (qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST))
49644972
qeth_query_setdiagass(card);
4973+
qeth_bridgeport_query_support(card);
4974+
if (card->options.sbp.supported_funcs)
4975+
dev_info(&card->gdev->dev,
4976+
"The device represents a HiperSockets Bridge Capable Port\n");
49654977
return 0;
49664978
out:
49674979
dev_warn(&card->gdev->dev, "The qeth device driver failed to recover "

drivers/s390/net/qeth_core_mpc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ static struct ipa_cmd_names qeth_ipa_cmd_names[] = {
249249
{IPA_CMD_DELIP, "delip"},
250250
{IPA_CMD_SETADAPTERPARMS, "setadapterparms"},
251251
{IPA_CMD_SET_DIAG_ASS, "set_diag_ass"},
252+
{IPA_CMD_SETBRIDGEPORT, "set_bridge_port"},
252253
{IPA_CMD_CREATE_ADDR, "create_addr"},
253254
{IPA_CMD_DESTROY_ADDR, "destroy_addr"},
254255
{IPA_CMD_REGISTER_LOCAL_ADDR, "register_local_addr"},

drivers/s390/net/qeth_core_mpc.h

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ enum qeth_ipa_cmds {
104104
IPA_CMD_DELIP = 0xb7,
105105
IPA_CMD_SETADAPTERPARMS = 0xb8,
106106
IPA_CMD_SET_DIAG_ASS = 0xb9,
107+
IPA_CMD_SETBRIDGEPORT = 0xbe,
107108
IPA_CMD_CREATE_ADDR = 0xc3,
108109
IPA_CMD_DESTROY_ADDR = 0xc4,
109110
IPA_CMD_REGISTER_LOCAL_ADDR = 0xd1,
@@ -500,6 +501,88 @@ struct qeth_ipacmd_diagass {
500501
__u8 cdata[64];
501502
} __attribute__ ((packed));
502503

504+
/* SETBRIDGEPORT IPA Command: *********************************************/
505+
enum qeth_ipa_sbp_cmd {
506+
IPA_SBP_QUERY_COMMANDS_SUPPORTED = 0x00000000L,
507+
IPA_SBP_RESET_BRIDGE_PORT_ROLE = 0x00000001L,
508+
IPA_SBP_SET_PRIMARY_BRIDGE_PORT = 0x00000002L,
509+
IPA_SBP_SET_SECONDARY_BRIDGE_PORT = 0x00000004L,
510+
IPA_SBP_QUERY_BRIDGE_PORTS = 0x00000008L,
511+
IPA_SBP_BRIDGE_PORT_STATE_CHANGE = 0x00000010L,
512+
};
513+
514+
struct net_if_token {
515+
__u16 devnum;
516+
__u8 cssid;
517+
__u8 iid;
518+
__u8 ssid;
519+
__u8 chpid;
520+
__u16 chid;
521+
} __packed;
522+
523+
struct qeth_ipacmd_sbp_hdr {
524+
__u32 supported_sbp_cmds;
525+
__u32 enabled_sbp_cmds;
526+
__u16 cmdlength;
527+
__u16 reserved1;
528+
__u32 command_code;
529+
__u16 return_code;
530+
__u8 used_total;
531+
__u8 seq_no;
532+
__u32 reserved2;
533+
} __packed;
534+
535+
struct qeth_sbp_query_cmds_supp {
536+
__u32 supported_cmds;
537+
__u32 reserved;
538+
} __packed;
539+
540+
struct qeth_sbp_reset_role {
541+
} __packed;
542+
543+
struct qeth_sbp_set_primary {
544+
struct net_if_token token;
545+
} __packed;
546+
547+
struct qeth_sbp_set_secondary {
548+
} __packed;
549+
550+
struct qeth_sbp_port_entry {
551+
__u8 role;
552+
__u8 state;
553+
__u8 reserved1;
554+
__u8 reserved2;
555+
struct net_if_token token;
556+
} __packed;
557+
558+
struct qeth_sbp_query_ports {
559+
__u8 primary_bp_supported;
560+
__u8 secondary_bp_supported;
561+
__u8 num_entries;
562+
__u8 entry_length;
563+
struct qeth_sbp_port_entry entry[];
564+
} __packed;
565+
566+
struct qeth_sbp_state_change {
567+
__u8 primary_bp_supported;
568+
__u8 secondary_bp_supported;
569+
__u8 num_entries;
570+
__u8 entry_length;
571+
struct qeth_sbp_port_entry entry[];
572+
} __packed;
573+
574+
struct qeth_ipacmd_setbridgeport {
575+
struct qeth_ipacmd_sbp_hdr hdr;
576+
union {
577+
struct qeth_sbp_query_cmds_supp query_cmds_supp;
578+
struct qeth_sbp_reset_role reset_role;
579+
struct qeth_sbp_set_primary set_primary;
580+
struct qeth_sbp_set_secondary set_secondary;
581+
struct qeth_sbp_query_ports query_ports;
582+
struct qeth_sbp_state_change state_change;
583+
} data;
584+
} __packed;
585+
503586
/* Header for each IPA command */
504587
struct qeth_ipacmd_hdr {
505588
__u8 command;
@@ -529,6 +612,7 @@ struct qeth_ipa_cmd {
529612
struct qeth_ipacmd_setadpparms setadapterparms;
530613
struct qeth_set_routing setrtg;
531614
struct qeth_ipacmd_diagass diagass;
615+
struct qeth_ipacmd_setbridgeport sbp;
532616
} data;
533617
} __attribute__ ((packed));
534618

drivers/s390/net/qeth_l2.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright IBM Corp. 2013
3+
* Author(s): Eugene Crosser <eugene.crosser@ru.ibm.com>
4+
*/
5+
6+
#ifndef __QETH_L2_H__
7+
#define __QETH_L2_H__
8+
9+
#include "qeth_core.h"
10+
11+
int qeth_l2_create_device_attributes(struct device *);
12+
void qeth_l2_remove_device_attributes(struct device *);
13+
void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card);
14+
15+
#endif /* __QETH_L2_H__ */

0 commit comments

Comments
 (0)