@@ -748,8 +748,8 @@ static void qeth_issue_next_read_cb(struct qeth_card *card,
748
748
goto out ;
749
749
}
750
750
751
- if ( IS_IPA ( iob -> data )) {
752
- cmd = ( struct qeth_ipa_cmd * ) PDU_ENCAPSULATION ( iob -> data );
751
+ cmd = __ipa_reply ( iob );
752
+ if ( cmd ) {
753
753
cmd = qeth_check_ipa_data (card , cmd );
754
754
if (!cmd )
755
755
goto out ;
@@ -758,17 +758,12 @@ static void qeth_issue_next_read_cb(struct qeth_card *card,
758
758
card -> osn_info .assist_cb (card -> dev , cmd );
759
759
goto out ;
760
760
}
761
- } else {
762
- /* non-IPA commands should only flow during initialization */
763
- if (card -> state != CARD_STATE_DOWN )
764
- goto out ;
765
761
}
766
762
767
763
/* match against pending cmd requests */
768
764
spin_lock_irqsave (& card -> lock , flags );
769
765
list_for_each_entry (tmp , & card -> cmd_waiter_list , list ) {
770
- if (!IS_IPA (tmp -> data ) ||
771
- __ipa_cmd (tmp )-> hdr .seqno == cmd -> hdr .seqno ) {
766
+ if (tmp -> match && tmp -> match (tmp , iob )) {
772
767
request = tmp ;
773
768
/* take the object outside the lock */
774
769
qeth_get_cmd (request );
@@ -1688,6 +1683,13 @@ static void qeth_mpc_finalize_cmd(struct qeth_card *card,
1688
1683
iob -> callback = qeth_release_buffer_cb ;
1689
1684
}
1690
1685
1686
+ static bool qeth_mpc_match_reply (struct qeth_cmd_buffer * iob ,
1687
+ struct qeth_cmd_buffer * reply )
1688
+ {
1689
+ /* MPC cmds are issued strictly in sequence. */
1690
+ return !IS_IPA (reply -> data );
1691
+ }
1692
+
1691
1693
static struct qeth_cmd_buffer * qeth_mpc_alloc_cmd (struct qeth_card * card ,
1692
1694
void * data ,
1693
1695
unsigned int data_length )
@@ -1702,6 +1704,7 @@ static struct qeth_cmd_buffer *qeth_mpc_alloc_cmd(struct qeth_card *card,
1702
1704
qeth_setup_ccw (__ccw_from_cmd (iob ), CCW_CMD_WRITE , 0 , data_length ,
1703
1705
iob -> data );
1704
1706
iob -> finalize = qeth_mpc_finalize_cmd ;
1707
+ iob -> match = qeth_mpc_match_reply ;
1705
1708
return iob ;
1706
1709
}
1707
1710
@@ -2722,14 +2725,17 @@ static void qeth_ipa_finalize_cmd(struct qeth_card *card,
2722
2725
}
2723
2726
2724
2727
void qeth_prepare_ipa_cmd (struct qeth_card * card , struct qeth_cmd_buffer * iob ,
2725
- u16 cmd_length )
2728
+ u16 cmd_length ,
2729
+ bool (* match )(struct qeth_cmd_buffer * iob ,
2730
+ struct qeth_cmd_buffer * reply ))
2726
2731
{
2727
2732
u8 prot_type = qeth_mpc_select_prot_type (card );
2728
2733
u16 total_length = iob -> length ;
2729
2734
2730
2735
qeth_setup_ccw (__ccw_from_cmd (iob ), CCW_CMD_WRITE , 0 , total_length ,
2731
2736
iob -> data );
2732
2737
iob -> finalize = qeth_ipa_finalize_cmd ;
2738
+ iob -> match = match ;
2733
2739
2734
2740
memcpy (iob -> data , IPA_PDU_HEADER , IPA_PDU_HEADER_SIZE );
2735
2741
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,
2742
2748
}
2743
2749
EXPORT_SYMBOL_GPL (qeth_prepare_ipa_cmd );
2744
2750
2751
+ static bool qeth_ipa_match_reply (struct qeth_cmd_buffer * iob ,
2752
+ struct qeth_cmd_buffer * reply )
2753
+ {
2754
+ struct qeth_ipa_cmd * ipa_reply = __ipa_reply (reply );
2755
+
2756
+ return ipa_reply && (__ipa_cmd (iob )-> hdr .seqno == ipa_reply -> hdr .seqno );
2757
+ }
2758
+
2745
2759
struct qeth_cmd_buffer * qeth_ipa_alloc_cmd (struct qeth_card * card ,
2746
2760
enum qeth_ipa_cmds cmd_code ,
2747
2761
enum qeth_prot_versions prot ,
@@ -2757,7 +2771,7 @@ struct qeth_cmd_buffer *qeth_ipa_alloc_cmd(struct qeth_card *card,
2757
2771
if (!iob )
2758
2772
return NULL ;
2759
2773
2760
- qeth_prepare_ipa_cmd (card , iob , data_length );
2774
+ qeth_prepare_ipa_cmd (card , iob , data_length , qeth_ipa_match_reply );
2761
2775
2762
2776
hdr = & __ipa_cmd (iob )-> hdr ;
2763
2777
hdr -> command = cmd_code ;
0 commit comments