@@ -54,8 +54,6 @@ struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS] = {
5454};
5555EXPORT_SYMBOL_GPL (qeth_dbf );
5656
57- struct qeth_card_list_struct qeth_core_card_list ;
58- EXPORT_SYMBOL_GPL (qeth_core_card_list );
5957struct kmem_cache * qeth_core_header_cache ;
6058EXPORT_SYMBOL_GPL (qeth_core_header_cache );
6159static struct kmem_cache * qeth_qdio_outbuf_cache ;
@@ -2837,13 +2835,25 @@ static void qeth_fill_ipacmd_header(struct qeth_card *card,
28372835 cmd -> hdr .prot_version = prot ;
28382836}
28392837
2838+ void qeth_prepare_ipa_cmd (struct qeth_card * card , struct qeth_cmd_buffer * iob )
2839+ {
2840+ u8 prot_type = qeth_mpc_select_prot_type (card );
2841+
2842+ memcpy (iob -> data , IPA_PDU_HEADER , IPA_PDU_HEADER_SIZE );
2843+ memcpy (QETH_IPA_CMD_PROT_TYPE (iob -> data ), & prot_type , 1 );
2844+ memcpy (QETH_IPA_CMD_DEST_ADDR (iob -> data ),
2845+ & card -> token .ulp_connection_r , QETH_MPC_TOKEN_LENGTH );
2846+ }
2847+ EXPORT_SYMBOL_GPL (qeth_prepare_ipa_cmd );
2848+
28402849struct qeth_cmd_buffer * qeth_get_ipacmd_buffer (struct qeth_card * card ,
28412850 enum qeth_ipa_cmds ipacmd , enum qeth_prot_versions prot )
28422851{
28432852 struct qeth_cmd_buffer * iob ;
28442853
28452854 iob = qeth_get_buffer (& card -> write );
28462855 if (iob ) {
2856+ qeth_prepare_ipa_cmd (card , iob );
28472857 qeth_fill_ipacmd_header (card , __ipa_cmd (iob ), ipacmd , prot );
28482858 } else {
28492859 dev_warn (& card -> gdev -> dev ,
@@ -2856,17 +2866,6 @@ struct qeth_cmd_buffer *qeth_get_ipacmd_buffer(struct qeth_card *card,
28562866}
28572867EXPORT_SYMBOL_GPL (qeth_get_ipacmd_buffer );
28582868
2859- void qeth_prepare_ipa_cmd (struct qeth_card * card , struct qeth_cmd_buffer * iob )
2860- {
2861- u8 prot_type = qeth_mpc_select_prot_type (card );
2862-
2863- memcpy (iob -> data , IPA_PDU_HEADER , IPA_PDU_HEADER_SIZE );
2864- memcpy (QETH_IPA_CMD_PROT_TYPE (iob -> data ), & prot_type , 1 );
2865- memcpy (QETH_IPA_CMD_DEST_ADDR (iob -> data ),
2866- & card -> token .ulp_connection_r , QETH_MPC_TOKEN_LENGTH );
2867- }
2868- EXPORT_SYMBOL_GPL (qeth_prepare_ipa_cmd );
2869-
28702869/**
28712870 * qeth_send_ipa_cmd() - send an IPA command
28722871 *
@@ -2881,7 +2880,6 @@ int qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
28812880 int rc ;
28822881
28832882 QETH_CARD_TEXT (card , 4 , "sendipa" );
2884- qeth_prepare_ipa_cmd (card , iob );
28852883 rc = qeth_send_control_data (card , IPA_CMD_LENGTH ,
28862884 iob , reply_cb , reply_param );
28872885 if (rc == - ETIME ) {
@@ -3777,9 +3775,9 @@ EXPORT_SYMBOL_GPL(qeth_count_elements);
37773775 * The number of needed buffer elements is returned in @elements.
37783776 * Error to create the hdr is indicated by returning with < 0.
37793777 */
3780- int qeth_add_hw_header (struct qeth_card * card , struct sk_buff * skb ,
3781- struct qeth_hdr * * hdr , unsigned int hdr_len ,
3782- unsigned int proto_len , unsigned int * elements )
3778+ static int qeth_add_hw_header (struct qeth_card * card , struct sk_buff * skb ,
3779+ struct qeth_hdr * * hdr , unsigned int hdr_len ,
3780+ unsigned int proto_len , unsigned int * elements )
37833781{
37843782 const unsigned int max_elements = QETH_MAX_BUFFER_ELEMENTS (card );
37853783 const unsigned int contiguous = proto_len ? proto_len : 1 ;
@@ -3849,7 +3847,6 @@ int qeth_add_hw_header(struct qeth_card *card, struct sk_buff *skb,
38493847 skb_copy_from_linear_data (skb , ((char * )* hdr ) + hdr_len , proto_len );
38503848 return 0 ;
38513849}
3852- EXPORT_SYMBOL_GPL (qeth_add_hw_header );
38533850
38543851static void __qeth_fill_buffer (struct sk_buff * skb ,
38553852 struct qeth_qdio_out_buffer * buf ,
@@ -3972,9 +3969,9 @@ static int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
39723969 return flush_cnt ;
39733970}
39743971
3975- int qeth_do_send_packet_fast (struct qeth_qdio_out_q * queue , struct sk_buff * skb ,
3976- struct qeth_hdr * hdr , unsigned int offset ,
3977- unsigned int hd_len )
3972+ static int qeth_do_send_packet_fast (struct qeth_qdio_out_q * queue ,
3973+ struct sk_buff * skb , struct qeth_hdr * hdr ,
3974+ unsigned int offset , unsigned int hd_len )
39783975{
39793976 int index = queue -> next_buf_to_fill ;
39803977 struct qeth_qdio_out_buffer * buffer = queue -> bufs [index ];
@@ -3990,7 +3987,6 @@ int qeth_do_send_packet_fast(struct qeth_qdio_out_q *queue, struct sk_buff *skb,
39903987 qeth_flush_buffers (queue , index , 1 );
39913988 return 0 ;
39923989}
3993- EXPORT_SYMBOL_GPL (qeth_do_send_packet_fast );
39943990
39953991int qeth_do_send_packet (struct qeth_card * card , struct qeth_qdio_out_q * queue ,
39963992 struct sk_buff * skb , struct qeth_hdr * hdr ,
@@ -4082,8 +4078,9 @@ int qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue,
40824078}
40834079EXPORT_SYMBOL_GPL (qeth_do_send_packet );
40844080
4085- void qeth_fill_tso_ext (struct qeth_hdr_tso * hdr , unsigned int payload_len ,
4086- struct sk_buff * skb , unsigned int proto_len )
4081+ static void qeth_fill_tso_ext (struct qeth_hdr_tso * hdr ,
4082+ unsigned int payload_len , struct sk_buff * skb ,
4083+ unsigned int proto_len )
40874084{
40884085 struct qeth_hdr_ext_tso * ext = & hdr -> ext ;
40894086
@@ -4096,7 +4093,6 @@ void qeth_fill_tso_ext(struct qeth_hdr_tso *hdr, unsigned int payload_len,
40964093 ext -> mss = skb_shinfo (skb )-> gso_size ;
40974094 ext -> dg_hdr_len = proto_len ;
40984095}
4099- EXPORT_SYMBOL_GPL (qeth_fill_tso_ext );
41004096
41014097int qeth_xmit (struct qeth_card * card , struct sk_buff * skb ,
41024098 struct qeth_qdio_out_q * queue , int ipv , int cast_type ,
@@ -4119,7 +4115,7 @@ int qeth_xmit(struct qeth_card *card, struct sk_buff *skb,
41194115 proto_len = skb_transport_offset (skb ) + tcp_hdrlen (skb );
41204116 } else {
41214117 hw_hdr_len = sizeof (struct qeth_hdr );
4122- proto_len = IS_IQD (card ) ? ETH_HLEN : 0 ;
4118+ proto_len = ( IS_IQD (card ) && IS_LAYER2 ( card ) ) ? ETH_HLEN : 0 ;
41234119 }
41244120
41254121 rc = skb_cow_head (skb , hw_hdr_len );
@@ -4235,16 +4231,18 @@ static int qeth_setadpparms_change_macaddr_cb(struct qeth_card *card,
42354231 struct qeth_reply * reply , unsigned long data )
42364232{
42374233 struct qeth_ipa_cmd * cmd = (struct qeth_ipa_cmd * ) data ;
4234+ struct qeth_ipacmd_setadpparms * adp_cmd ;
42384235
42394236 QETH_CARD_TEXT (card , 4 , "chgmaccb" );
42404237 if (qeth_setadpparms_inspect_rc (cmd ))
42414238 return 0 ;
42424239
4243- if (IS_LAYER3 (card ) || !(card -> info .mac_bits & QETH_LAYER2_MAC_READ )) {
4244- ether_addr_copy (card -> dev -> dev_addr ,
4245- cmd -> data .setadapterparms .data .change_addr .addr );
4246- card -> info .mac_bits |= QETH_LAYER2_MAC_READ ;
4247- }
4240+ adp_cmd = & cmd -> data .setadapterparms ;
4241+ if (IS_LAYER2 (card ) && IS_OSD (card ) && !IS_VM_NIC (card ) &&
4242+ !(adp_cmd -> hdr .flags & QETH_SETADP_FLAGS_VIRTUAL_MAC ))
4243+ return 0 ;
4244+
4245+ ether_addr_copy (card -> dev -> dev_addr , adp_cmd -> data .change_addr .addr );
42484246 return 0 ;
42494247}
42504248
@@ -4499,9 +4497,6 @@ static int qeth_send_ipa_snmp_cmd(struct qeth_card *card,
44994497
45004498 QETH_CARD_TEXT (card , 4 , "sendsnmp" );
45014499
4502- memcpy (iob -> data , IPA_PDU_HEADER , IPA_PDU_HEADER_SIZE );
4503- memcpy (QETH_IPA_CMD_DEST_ADDR (iob -> data ),
4504- & card -> token .ulp_connection_r , QETH_MPC_TOKEN_LENGTH );
45054500 /* adjust PDU length fields in IPA_PDU_HEADER */
45064501 s1 = (u32 ) IPA_PDU_HEADER_SIZE + len ;
45074502 s2 = (u32 ) len ;
@@ -5480,34 +5475,11 @@ struct qeth_cmd_buffer *qeth_get_setassparms_cmd(struct qeth_card *card,
54805475}
54815476EXPORT_SYMBOL_GPL (qeth_get_setassparms_cmd );
54825477
5483- static int qeth_send_setassparms (struct qeth_card * card ,
5484- struct qeth_cmd_buffer * iob , u16 len ,
5485- long data , int (* reply_cb )(struct qeth_card * ,
5486- struct qeth_reply * ,
5487- unsigned long ),
5488- void * reply_param )
5489- {
5490- int rc ;
5491- struct qeth_ipa_cmd * cmd ;
5492-
5493- QETH_CARD_TEXT (card , 4 , "sendassp" );
5494-
5495- cmd = __ipa_cmd (iob );
5496- if (len <= sizeof (__u32 ))
5497- cmd -> data .setassparms .data .flags_32bit = (__u32 ) data ;
5498- else /* (len > sizeof(__u32)) */
5499- memcpy (& cmd -> data .setassparms .data , (void * ) data , len );
5500-
5501- rc = qeth_send_ipa_cmd (card , iob , reply_cb , reply_param );
5502- return rc ;
5503- }
5504-
55055478int qeth_send_simple_setassparms_prot (struct qeth_card * card ,
55065479 enum qeth_ipa_funcs ipa_func ,
55075480 u16 cmd_code , long data ,
55085481 enum qeth_prot_versions prot )
55095482{
5510- int rc ;
55115483 int length = 0 ;
55125484 struct qeth_cmd_buffer * iob ;
55135485
@@ -5517,9 +5489,9 @@ int qeth_send_simple_setassparms_prot(struct qeth_card *card,
55175489 iob = qeth_get_setassparms_cmd (card , ipa_func , cmd_code , length , prot );
55185490 if (!iob )
55195491 return - ENOMEM ;
5520- rc = qeth_send_setassparms ( card , iob , length , data ,
5521- qeth_setassparms_cb , NULL ) ;
5522- return rc ;
5492+
5493+ __ipa_cmd ( iob ) -> data . setassparms . data . flags_32bit = ( __u32 ) data ;
5494+ return qeth_send_ipa_cmd ( card , iob , qeth_setassparms_cb , NULL ) ;
55235495}
55245496EXPORT_SYMBOL_GPL (qeth_send_simple_setassparms_prot );
55255497
@@ -5806,9 +5778,6 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
58065778 break ;
58075779 }
58085780
5809- write_lock_irq (& qeth_core_card_list .rwlock );
5810- list_add_tail (& card -> list , & qeth_core_card_list .list );
5811- write_unlock_irq (& qeth_core_card_list .rwlock );
58125781 return 0 ;
58135782
58145783err_disc :
@@ -5833,9 +5802,6 @@ static void qeth_core_remove_device(struct ccwgroup_device *gdev)
58335802 qeth_core_free_discipline (card );
58345803 }
58355804
5836- write_lock_irq (& qeth_core_card_list .rwlock );
5837- list_del (& card -> list );
5838- write_unlock_irq (& qeth_core_card_list .rwlock );
58395805 free_netdev (card -> dev );
58405806 qeth_core_free_card (card );
58415807 put_device (& gdev -> dev );
@@ -5950,6 +5916,21 @@ static struct ccwgroup_driver qeth_core_ccwgroup_driver = {
59505916 .restore = qeth_core_restore ,
59515917};
59525918
5919+ struct qeth_card * qeth_get_card_by_busid (char * bus_id )
5920+ {
5921+ struct ccwgroup_device * gdev ;
5922+ struct qeth_card * card ;
5923+
5924+ gdev = get_ccwgroupdev_by_busid (& qeth_core_ccwgroup_driver , bus_id );
5925+ if (!gdev )
5926+ return NULL ;
5927+
5928+ card = dev_get_drvdata (& gdev -> dev );
5929+ put_device (& gdev -> dev );
5930+ return card ;
5931+ }
5932+ EXPORT_SYMBOL_GPL (qeth_get_card_by_busid );
5933+
59535934int qeth_do_ioctl (struct net_device * dev , struct ifreq * rq , int cmd )
59545935{
59555936 struct qeth_card * card = dev -> ml_priv ;
@@ -6381,16 +6362,16 @@ static int qeth_ipa_checksum_run_cmd(struct qeth_card *card,
63816362 enum qeth_prot_versions prot )
63826363{
63836364 struct qeth_cmd_buffer * iob ;
6384- int rc = - ENOMEM ;
63856365
63866366 QETH_CARD_TEXT (card , 4 , "chkdocmd" );
63876367 iob = qeth_get_setassparms_cmd (card , ipa_func , cmd_code ,
63886368 sizeof (__u32 ), prot );
6389- if (iob )
6390- rc = qeth_send_setassparms (card , iob , sizeof (__u32 ), data ,
6391- qeth_ipa_checksum_run_cmd_cb ,
6392- chksum_cb );
6393- return rc ;
6369+ if (!iob )
6370+ return - ENOMEM ;
6371+
6372+ __ipa_cmd (iob )-> data .setassparms .data .flags_32bit = (__u32 ) data ;
6373+ return qeth_send_ipa_cmd (card , iob , qeth_ipa_checksum_run_cmd_cb ,
6374+ chksum_cb );
63946375}
63956376
63966377static int qeth_send_checksum_on (struct qeth_card * card , int cstype ,
@@ -6488,8 +6469,7 @@ static int qeth_set_tso_on(struct qeth_card *card,
64886469 if (!iob )
64896470 return - ENOMEM ;
64906471
6491- rc = qeth_send_setassparms (card , iob , 0 , 0 /* unused */ ,
6492- qeth_start_tso_cb , & tso_data );
6472+ rc = qeth_send_ipa_cmd (card , iob , qeth_start_tso_cb , & tso_data );
64936473 if (rc )
64946474 return rc ;
64956475
@@ -6506,10 +6486,9 @@ static int qeth_set_tso_on(struct qeth_card *card,
65066486 }
65076487
65086488 /* enable TSO capability */
6509- caps .supported = 0 ;
6510- caps .enabled = QETH_IPA_LARGE_SEND_TCP ;
6511- rc = qeth_send_setassparms (card , iob , sizeof (caps ), (long ) & caps ,
6512- qeth_setassparms_get_caps_cb , & caps );
6489+ __ipa_cmd (iob )-> data .setassparms .data .caps .enabled =
6490+ QETH_IPA_LARGE_SEND_TCP ;
6491+ rc = qeth_send_ipa_cmd (card , iob , qeth_setassparms_get_caps_cb , & caps );
65136492 if (rc ) {
65146493 qeth_set_tso_off (card , prot );
65156494 return rc ;
@@ -6688,8 +6667,6 @@ static int __init qeth_core_init(void)
66886667 int rc ;
66896668
66906669 pr_info ("loading core functions\n" );
6691- INIT_LIST_HEAD (& qeth_core_card_list .list );
6692- rwlock_init (& qeth_core_card_list .rwlock );
66936670
66946671 qeth_wq = create_singlethread_workqueue ("qeth_wq" );
66956672 if (!qeth_wq ) {
0 commit comments