s390/qeth: updates 2020-01-25
Subsystems (4)
cover s390/qeth: updates 2020-01-25
Hi Dave,
please apply the following patch series for qeth to your net-next tree.
This brings a number of cleanups for the init/teardown code paths.
Thanks,
Julian
Julian Wiedmann (5):
s390/qeth: shift some bridgeport code around s390/qeth: consolidate QDIO queue setup s390/qeth: consolidate online/offline code s390/qeth: make cmd/reply matching more flexible s390/qeth: remove HARDSETUP state
drivers/s390/net/qeth_core.h | 25 +++-- drivers/s390/net/qeth_core_main.c | 156 ++++++++++++++++++++++++------ drivers/s390/net/qeth_core_sys.c | 2 - drivers/s390/net/qeth_l2.h | 1 - drivers/s390/net/qeth_l2_main.c | 126 ++++++------------------ drivers/s390/net/qeth_l2_sys.c | 34 ------- drivers/s390/net/qeth_l3_main.c | 109 ++------------------- 7 files changed, 180 insertions(+), 273 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/5 s390/qeth: shift some bridgeport code around
qeth_l2_setup_bridgeport_attrs() is entirely unrelated to sysfs functionality, move it where it belongs.
While at it merge all the bridgeport-specific code in the set-online path together.
--- drivers/s390/net/qeth_l2.h | 1 - drivers/s390/net/qeth_l2_main.c | 26 +++++++++++++++++++++---- drivers/s390/net/qeth_l2_sys.c | 34 --------------------------------- 3 files changed, 22 insertions(+), 39 deletions(-)
drivers/s390/net/qeth_l2.h +0 -1
@@ -13,7 +13,6 @@ extern const struct attribute_group *qeth_l2_attr_groups[];int qeth_l2_create_device_attributes (struct device *);void qeth_l2_remove_device_attributes (struct device *); -void qeth_l2_setup_bridgeport_attrs (struct qeth_card *card);int qeth_bridgeport_query_ports (struct qeth_card *card,enum qeth_sbp_roles *role,enum qeth_sbp_states *state);
drivers/s390/net/qeth_l2_main.c +22 -4
@@ -728,6 +728,24 @@ static void qeth_l2_trace_features(struct qeth_card *card) sizeof(card->options.vnicc.sup_chars)); } +static void qeth_l2_setup_bridgeport_attrs (struct qeth_card *card) +{ +if (!card->options.sbp.reflect_promisc && + card->options.sbp.role !=QETH_SBP_ROLE_NONE ) { +/* Conditional to avoid spurious error messages */ +qeth_bridgeport_setrole (card, card->options.sbp.role); +/* Let the callback function refresh the stored role value. */ +qeth_bridgeport_query_ports (card, &card->options.sbp.role, +NULL ); + } +if (card->options.sbp.hostnotification) { +if (qeth_bridgeport_an_set (card,1 )) + card->options.sbp.hostnotification =0 ; + }else { +qeth_bridgeport_an_set (card,0 ); + } +} +static int qeth_l2_set_online (struct ccwgroup_device *gdev) {struct qeth_card *card =dev_get_drvdata (&gdev->dev);
@@ -748,9 +766,11 @@ static int qeth_l2_set_online(struct ccwgroup_device *gdev)mutex_lock (&card->sbp_lock);qeth_bridgeport_query_support (card); -if (card->options.sbp.supported_funcs) +if (card->options.sbp.supported_funcs) { +qeth_l2_setup_bridgeport_attrs (card);dev_info (&card->gdev->dev, -"The device represents a Bridge Capable Port\n" ); +"The device represents a Bridge Capable Port\n" ); + }mutex_unlock (&card->sbp_lock);qeth_l2_register_dev_addr (card);
@@ -761,8 +781,6 @@ static int qeth_l2_set_online(struct ccwgroup_device *gdev)qeth_trace_features (card);qeth_l2_trace_features (card); -qeth_l2_setup_bridgeport_attrs (card); - card->state =CARD_STATE_HARDSETUP ;qeth_print_status_message (card);
drivers/s390/net/qeth_l2_sys.c +0 -34
@@ -246,40 +246,6 @@ static struct attribute_group qeth_l2_bridgeport_attr_group = { .attrs = qeth_l2_bridgeport_attrs, }; -/** -* qeth_l2_setup_bridgeport_attrs() - set/restore attrs when turning online. -* @card: qeth_card structure pointer -* -* Note: this function is called with conf_mutex held by the caller -*/ -void qeth_l2_setup_bridgeport_attrs (struct qeth_card *card) -{ -int rc; - -if (!card) -return ; -if (!card->options.sbp.supported_funcs) -return ; - -mutex_lock (&card->sbp_lock); -if (!card->options.sbp.reflect_promisc && - card->options.sbp.role !=QETH_SBP_ROLE_NONE ) { -/* Conditional to avoid spurious error messages */ -qeth_bridgeport_setrole (card, card->options.sbp.role); -/* Let the callback function refresh the stored role value. */ -qeth_bridgeport_query_ports (card, - &card->options.sbp.role,NULL ); - } -if (card->options.sbp.hostnotification) { - rc =qeth_bridgeport_an_set (card,1 ); -if (rc) - card->options.sbp.hostnotification =0 ; - }else { -qeth_bridgeport_an_set (card,0 ); - } -mutex_unlock (&card->sbp_lock); -} -/* VNIC CHARS support */ /* convert sysfs attr name to VNIC characteristic */
Signature · 1 line
2.17.1
PATCH 2/5 s390/qeth: consolidate QDIO queue setup
In reply to Julian WiedmannMove some duplicated logic into a shared code path.
--- drivers/s390/net/qeth_core.h | 1 - drivers/s390/net/qeth_core_main.c | 9 +++++++-- drivers/s390/net/qeth_l2_main.c | 8 +------- drivers/s390/net/qeth_l3_main.c | 8 +------- 4 files changed, 9 insertions(+), 17 deletions(-)
drivers/s390/net/qeth_core.h +0 -1
@@ -994,7 +994,6 @@ int qeth_core_hardsetup_card(struct qeth_card *card, bool *carrier_ok);int qeth_stop_channel (struct qeth_channel *channel);void qeth_print_status_message (struct qeth_card *); -int qeth_init_qdio_queues (struct qeth_card *); int qeth_send_ipa_cmd(struct qeth_card *, struct qeth_cmd_buffer *, int (*reply_cb) (struct qeth_card *, struct qeth_reply *, unsigned long),
drivers/s390/net/qeth_core_main.c +7 -2
@@ -2665,7 +2665,7 @@ static unsigned int qeth_tx_select_bulk_max(struct qeth_card *card,return card->ssqd.mmwc ? card->ssqd.mmwc :1 ; } -int qeth_init_qdio_queues (struct qeth_card *card) +static int qeth_init_qdio_queues (struct qeth_card *card) {unsigned int i;int rc;
@@ -2713,7 +2713,6 @@ int qeth_init_qdio_queues(struct qeth_card *card) }return 0 ; } -EXPORT_SYMBOL_GPL (qeth_init_qdio_queues);static void qeth_ipa_finalize_cmd (struct qeth_card *card,struct qeth_cmd_buffer *iob)
@@ -5026,6 +5025,12 @@ int qeth_core_hardsetup_card(struct qeth_card *card, bool *carrier_ok)if (rc) goto out; + rc =qeth_init_qdio_queues (card); +if (rc) { +QETH_CARD_TEXT_ (card,2 ,"9err%d" , rc); + goto out; + } +return 0 ; out: dev_warn(&card->gdev->dev, "The qeth device driver failed to recover "
drivers/s390/net/qeth_l2_main.c +1 -7
@@ -288,11 +288,11 @@ static void qeth_l2_stop_card(struct qeth_card *card) }if (card->state ==CARD_STATE_HARDSETUP ) {qeth_drain_output_queues (card); -qeth_clear_working_pool_list (card); card->state =CARD_STATE_DOWN ; }qeth_qdio_clear_card (card,0 ); +qeth_clear_working_pool_list (card);flush_workqueue (card->event_wq); card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED ; card->info.promisc_mode =0 ;
@@ -787,12 +787,6 @@ static int qeth_l2_set_online(struct ccwgroup_device *gdev)/* softsetup */ QETH_CARD_TEXT (card,2 ,"softsetp" ); - rc =qeth_init_qdio_queues (card); -if (rc) { -QETH_CARD_TEXT_ (card,2 ,"6err%d" , rc); - rc = -ENODEV ; - goto out_remove; - } card->state =CARD_STATE_SOFTSETUP ;qeth_set_allowed_threads (card,0xffffffff ,0 );
drivers/s390/net/qeth_l3_main.c +1 -7
@@ -1184,11 +1184,11 @@ static void qeth_l3_stop_card(struct qeth_card *card) }if (card->state ==CARD_STATE_HARDSETUP ) {qeth_drain_output_queues (card); -qeth_clear_working_pool_list (card); card->state =CARD_STATE_DOWN ; }qeth_qdio_clear_card (card,0 ); +qeth_clear_working_pool_list (card);flush_workqueue (card->event_wq); card->info.promisc_mode =0 ; }
@@ -2097,12 +2097,6 @@ static int qeth_l3_set_online(struct ccwgroup_device *gdev)QETH_CARD_TEXT_ (card,2 ,"5err%04x" , rc); } - rc =qeth_init_qdio_queues (card); -if (rc) { -QETH_CARD_TEXT_ (card,2 ,"6err%d" , rc); - rc = -ENODEV ; - goto out_remove; - } card->state =CARD_STATE_SOFTSETUP ;qeth_set_allowed_threads (card,0xffffffff ,0 );
Signature · 1 line
2.17.1
PATCH 3/5 s390/qeth: consolidate online/offline code
In reply to Julian WiedmannLarge parts of the online/offline code are identical now, and cleaning up the remaining stuff is easier with a shared core.
--- drivers/s390/net/qeth_core.h | 9 +-- drivers/s390/net/qeth_core_main.c | 110 ++++++++++++++++++++++++++---- drivers/s390/net/qeth_l2_main.c | 85 ++--------------------- drivers/s390/net/qeth_l3_main.c | 87 ++--------------------- 4 files changed, 107 insertions(+), 184 deletions(-)
drivers/s390/net/qeth_core.h +3 -6
@@ -727,11 +727,10 @@ struct qeth_osn_info {struct qeth_discipline {const struct device_type *devtype; -int (*recover)(void *ptr);int (*setup) (struct ccwgroup_device *);void (*remove) (struct ccwgroup_device *); -int (*set_online) (struct ccwgroup_device *); -int (*set_offline) (struct ccwgroup_device *); +int (*set_online)(struct qeth_card *card); +void (*set_offline)(struct qeth_card *card);int (*do_ioctl)(struct net_device *dev,struct ifreq *rq,int cmd);int (*control_event_handler)(struct qeth_card *card,struct qeth_ipa_cmd *cmd);
@@ -987,11 +986,9 @@ struct net_device *qeth_clone_netdev(struct net_device *orig);struct qeth_card *qeth_get_card_by_busid (char *bus_id);void qeth_set_allowed_threads (struct qeth_card *,unsigned long ,int );int qeth_threads_running (struct qeth_card *,unsigned long ); -int qeth_do_run_thread (struct qeth_card *,unsigned long ); -void qeth_clear_thread_start_bit (struct qeth_card *,unsigned long ); -void qeth_clear_thread_running_bit (struct qeth_card *,unsigned long );int qeth_core_hardsetup_card (struct qeth_card *card,bool *carrier_ok);int qeth_stop_channel (struct qeth_channel *channel); +int qeth_set_offline (struct qeth_card *card,bool resetting);void qeth_print_status_message (struct qeth_card *); int qeth_send_ipa_cmd(struct qeth_card *, struct qeth_cmd_buffer *,
drivers/s390/net/qeth_core_main.c +96 -14
195 lines not on this page · raw message
drivers/s390/net/qeth_l2_main.c +4 -81
131 lines not on this page · raw message
drivers/s390/net/qeth_l3_main.c +4 -83
133 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 4/5 s390/qeth: make cmd/reply matching more flexible
In reply to Julian WiedmannWhen data is received on the READ channel, the matching logic for cmds that are waiting for a reply is currently hard-coded into the channel's main IO callback.
Move this into a per-cmd callback, so that we can apply custom matching logic for each individual cmd.
This also allows us to remove the coarse-grained check for unexpected non-IPA replies, since they will no longer match against _all_ pending cmds.
Note that IDX cmds use _no_ matcher, since their reply is synchronously received as part of the cmd's IO.
--- drivers/s390/net/qeth_core.h | 14 ++++++++++++- drivers/s390/net/qeth_core_main.c | 34 ++++++++++++++++++++++--------- drivers/s390/net/qeth_l2_main.c | 3 ++- 3 files changed, 39 insertions(+), 12 deletions(-)
drivers/s390/net/qeth_core.h +13 -1
@@ -608,6 +608,8 @@ struct qeth_cmd_buffer {long timeout;unsigned char *data;void (*finalize)(struct qeth_card *card,struct qeth_cmd_buffer *iob); +bool (*match)(struct qeth_cmd_buffer *iob, +struct qeth_cmd_buffer *reply);void (*callback)(struct qeth_card *card,struct qeth_cmd_buffer *iob,unsigned int data_length);int rc;
@@ -618,6 +620,14 @@ static inline void qeth_get_cmd(struct qeth_cmd_buffer *iob)refcount_inc (&iob->ref_count); } +static inline struct qeth_ipa_cmd *__ipa_reply (struct qeth_cmd_buffer *iob) +{ +if (!IS_IPA (iob->data)) +return NULL ; + +return (struct qeth_ipa_cmd *)PDU_ENCAPSULATION (iob->data); +} +static inline struct qeth_ipa_cmd *__ipa_cmd (struct qeth_cmd_buffer *iob) {return (struct qeth_ipa_cmd *)(iob->data +IPA_PDU_HEADER_SIZE );
@@ -1023,7 +1033,9 @@ void qeth_setadp_promisc_mode(struct qeth_card *card, bool enable);int qeth_setadpparms_change_macaddr (struct qeth_card *);void qeth_tx_timeout (struct net_device *,unsigned int txqueue);void qeth_prepare_ipa_cmd (struct qeth_card *card,struct qeth_cmd_buffer *iob, -u16 cmd_length); +u16 cmd_length, +bool (*match)(struct qeth_cmd_buffer *iob, +struct qeth_cmd_buffer *reply));int qeth_query_switch_attributes (struct qeth_card *card,struct qeth_switch_info *sw_info); int qeth_query_card_info(struct qeth_card *card,
drivers/s390/net/qeth_core_main.c +24 -10
@@ -748,8 +748,8 @@ static void qeth_issue_next_read_cb(struct qeth_card *card, goto out; } -if (IS_IPA (iob->data)) { - cmd = (struct qeth_ipa_cmd *)PDU_ENCAPSULATION (iob->data); + cmd =__ipa_reply (iob); +if (cmd) { cmd =qeth_check_ipa_data (card, cmd);if (!cmd) goto out;
@@ -758,17 +758,12 @@ static void qeth_issue_next_read_cb(struct qeth_card *card, card->osn_info.assist_cb (card->dev, cmd); goto out; } - }else { -/* non-IPA commands should only flow during initialization */ -if (card->state !=CARD_STATE_DOWN ) - goto out; }/* match against pending cmd requests */ spin_lock_irqsave (&card->lock, flags);list_for_each_entry (tmp, &card->cmd_waiter_list, list) { -if (!IS_IPA (tmp->data) || -__ipa_cmd (tmp)->hdr.seqno == cmd->hdr.seqno) { +if (tmp->match && tmp->match (tmp, iob)) { request = tmp;/* take the object outside the lock */ qeth_get_cmd (request);
@@ -1688,6 +1683,13 @@ static void qeth_mpc_finalize_cmd(struct qeth_card *card, iob->callback = qeth_release_buffer_cb; } +static bool qeth_mpc_match_reply (struct qeth_cmd_buffer *iob, +struct qeth_cmd_buffer *reply) +{ +/* MPC cmds are issued strictly in sequence. */ +return !IS_IPA (reply->data); +} +static struct qeth_cmd_buffer *qeth_mpc_alloc_cmd (struct qeth_card *card,void *data,unsigned int data_length)
@@ -1702,6 +1704,7 @@ static struct qeth_cmd_buffer *qeth_mpc_alloc_cmd(struct qeth_card *card,qeth_setup_ccw (__ccw_from_cmd (iob),CCW_CMD_WRITE ,0 , data_length, iob->data); iob->finalize = qeth_mpc_finalize_cmd; + iob->match = qeth_mpc_match_reply;return iob; }
@@ -2722,7 +2725,9 @@ static void qeth_ipa_finalize_cmd(struct qeth_card *card, }void qeth_prepare_ipa_cmd (struct qeth_card *card,struct qeth_cmd_buffer *iob, -u16 cmd_length) +u16 cmd_length, +bool (*match)(struct qeth_cmd_buffer *iob, +struct qeth_cmd_buffer *reply)) {u8 prot_type =qeth_mpc_select_prot_type (card);u16 total_length = iob->length;
@@ -2730,6 +2735,7 @@ void qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,qeth_setup_ccw (__ccw_from_cmd (iob),CCW_CMD_WRITE ,0 , total_length, iob->data); iob->finalize = qeth_ipa_finalize_cmd; + iob->match = match;memcpy (iob->data,IPA_PDU_HEADER ,IPA_PDU_HEADER_SIZE );memcpy (QETH_IPA_PDU_LEN_TOTAL (iob->data), &total_length,2 );
@@ -2742,6 +2748,14 @@ void qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, }EXPORT_SYMBOL_GPL (qeth_prepare_ipa_cmd); +static bool qeth_ipa_match_reply (struct qeth_cmd_buffer *iob, +struct qeth_cmd_buffer *reply) +{ +struct qeth_ipa_cmd *ipa_reply =__ipa_reply (reply); + +return ipa_reply && (__ipa_cmd (iob)->hdr.seqno == ipa_reply->hdr.seqno); +} + struct qeth_cmd_buffer *qeth_ipa_alloc_cmd(struct qeth_card *card, enum qeth_ipa_cmds cmd_code, enum qeth_prot_versions prot,
@@ -2757,7 +2771,7 @@ struct qeth_cmd_buffer *qeth_ipa_alloc_cmd(struct qeth_card *card,if (!iob)return NULL ; -qeth_prepare_ipa_cmd (card, iob, data_length); +qeth_prepare_ipa_cmd (card, iob, data_length, qeth_ipa_match_reply); hdr = &__ipa_cmd (iob)->hdr; hdr->command = cmd_code;
drivers/s390/net/qeth_l2_main.c +2 -1
@@ -896,7 +896,8 @@ int qeth_osn_assist(struct net_device *dev, void *data, int data_len)if (!iob)return -ENOMEM ; -qeth_prepare_ipa_cmd (card, iob, (u16 ) data_len); +qeth_prepare_ipa_cmd (card, iob, (u16 ) data_len,NULL ); +memcpy (__ipa_cmd (iob), data, data_len); iob->callback = qeth_osn_assist_cb;return qeth_send_ipa_cmd (card, iob,NULL ,NULL );
Signature · 1 line
2.17.1
PATCH 5/5 s390/qeth: remove HARDSETUP state
In reply to Julian Wiedmannqeth_l?_stop_card() is _never_ called while in HARDSETUP state, and there's no other usage of the card state that relies on the DOWN -> HARDSETUP -> SOFTSETUP transition.
As related cleanup, remove the check in qeth_realloc_buffer_pool() as it is already done by the callers.
--- drivers/s390/net/qeth_core.h | 1 - drivers/s390/net/qeth_core_main.c | 3 --- drivers/s390/net/qeth_core_sys.c | 2 -- drivers/s390/net/qeth_l2_main.c | 4 ---- drivers/s390/net/qeth_l3_main.c | 14 +++----------- 5 files changed, 3 insertions(+), 21 deletions(-)
drivers/s390/net/qeth_core.h +0 -1
@@ -558,7 +558,6 @@ enum qeth_channel_states {*/ enum qeth_card_states {CARD_STATE_DOWN , -CARD_STATE_HARDSETUP ,CARD_STATE_SOFTSETUP , };
drivers/s390/net/qeth_core_main.c +0 -3
@@ -247,9 +247,6 @@ int qeth_realloc_buffer_pool(struct qeth_card *card, int bufcnt) {QETH_CARD_TEXT (card,2 ,"realcbp" ); -if (card->state !=CARD_STATE_DOWN ) -return -EPERM ; -/* TODO: steel/add buffers from/to a running card's buffer pool (?) */ qeth_clear_working_pool_list (card);qeth_free_buffer_pool (card);
drivers/s390/net/qeth_core_sys.c +0 -2
@@ -24,8 +24,6 @@ static ssize_t qeth_dev_state_show(struct device *dev,switch (card->state) {case CARD_STATE_DOWN :return sprintf (buf,"DOWN\n" ); -case CARD_STATE_HARDSETUP : -return sprintf (buf,"HARDSETUP\n" );case CARD_STATE_SOFTSETUP :if (card->dev->flags &IFF_UP ) return sprintf(buf, "UP (LAN %s)\n",
drivers/s390/net/qeth_l2_main.c +0 -4
@@ -283,9 +283,6 @@ static void qeth_l2_stop_card(struct qeth_card *card)if (card->state ==CARD_STATE_SOFTSETUP ) {qeth_clear_ipacmd_list (card); - card->state =CARD_STATE_HARDSETUP ; - } -if (card->state ==CARD_STATE_HARDSETUP ) {qeth_drain_output_queues (card); card->state =CARD_STATE_DOWN ; }
@@ -776,7 +773,6 @@ static int qeth_l2_set_online(struct qeth_card *card)qeth_trace_features (card);qeth_l2_trace_features (card); - card->state =CARD_STATE_HARDSETUP ;qeth_print_status_message (card);/* softsetup */
drivers/s390/net/qeth_l3_main.c +3 -11
@@ -901,7 +901,7 @@ static int qeth_l3_start_ipa_broadcast(struct qeth_card *card)return rc; } -static int qeth_l3_start_ipassists (struct qeth_card *card) +static void qeth_l3_start_ipassists (struct qeth_card *card) {QETH_CARD_TEXT (card,3 ,"strtipas" );
@@ -911,7 +911,6 @@ static int qeth_l3_start_ipassists(struct qeth_card *card)qeth_l3_start_ipa_multicast (card);/* go on*/ qeth_l3_start_ipa_ipv6 (card);/* go on*/ qeth_l3_start_ipa_broadcast (card);/* go on*/ -return 0 ; } static int qeth_l3_iqd_read_initial_mac_cb(struct qeth_card *card,
@@ -1178,9 +1177,6 @@ static void qeth_l3_stop_card(struct qeth_card *card)if (card->state ==CARD_STATE_SOFTSETUP ) {qeth_l3_clear_ip_htable (card,1 );qeth_clear_ipacmd_list (card); - card->state =CARD_STATE_HARDSETUP ; - } -if (card->state ==CARD_STATE_HARDSETUP ) {qeth_drain_output_queues (card); card->state =CARD_STATE_DOWN ; }
@@ -2068,7 +2064,6 @@ static int qeth_l3_set_online(struct qeth_card *card) goto out_remove; } - card->state =CARD_STATE_HARDSETUP ;qeth_print_status_message (card);/* softsetup */
@@ -2078,11 +2073,8 @@ static int qeth_l3_set_online(struct qeth_card *card)if (rc)QETH_CARD_TEXT_ (card,2 ,"2err%04x" , rc);if (!card->options.sniffer) { - rc =qeth_l3_start_ipassists (card); -if (rc) { -QETH_CARD_TEXT_ (card,2 ,"3err%d" , rc); - goto out_remove; - } +qeth_l3_start_ipassists (card); + rc =qeth_l3_setrouting_v4 (card);if (rc)QETH_CARD_TEXT_ (card,2 ,"4err%04x" , rc);
Signature · 1 line
2.17.1
David Miller
maintainerFrom: Julian Wiedmann <[email protected]>
Date: Sat, 25 Jan 2020 16:52:58 +0100
Quoted 3 lines
please apply the following patch series for qeth to your net-next tree.
This brings a number of cleanups for the init/teardown code paths.
Series applied, thank you.