hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/s390/net/qeth_core_mpc.h
....@@ -11,17 +11,16 @@
1111
1212 #include <asm/qeth.h>
1313 #include <uapi/linux/if_ether.h>
14
+#include <uapi/linux/in6.h>
1415
16
+extern const unsigned char IPA_PDU_HEADER[];
1517 #define IPA_PDU_HEADER_SIZE 0x40
1618 #define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer + 0x0e)
1719 #define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer + 0x26)
1820 #define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer + 0x29)
1921 #define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer + 0x3a)
2022
21
-extern unsigned char IPA_PDU_HEADER[];
2223 #define QETH_IPA_CMD_DEST_ADDR(buffer) (buffer + 0x2c)
23
-
24
-#define IPA_CMD_LENGTH (IPA_PDU_HEADER_SIZE + sizeof(struct qeth_ipa_cmd))
2524
2625 #define QETH_SEQ_NO_LENGTH 4
2726 #define QETH_MPC_TOKEN_LENGTH 4
....@@ -29,23 +28,6 @@
2928
3029 #define QETH_TIMEOUT (10 * HZ)
3130 #define QETH_IPA_TIMEOUT (45 * HZ)
32
-#define QETH_IDX_COMMAND_SEQNO 0xffff0000
33
-
34
-#define QETH_CLEAR_CHANNEL_PARM -10
35
-#define QETH_HALT_CHANNEL_PARM -11
36
-#define QETH_RCD_PARM -12
37
-
38
-static inline bool qeth_intparm_is_iob(unsigned long intparm)
39
-{
40
- switch (intparm) {
41
- case QETH_CLEAR_CHANNEL_PARM:
42
- case QETH_HALT_CHANNEL_PARM:
43
- case QETH_RCD_PARM:
44
- case 0:
45
- return false;
46
- }
47
- return true;
48
-}
4931
5032 /*****************************************************************************/
5133 /* IP Assist related definitions */
....@@ -56,6 +38,31 @@
5638 #define IPA_CMD_INITIATOR_OSA_REPLY 0x81
5739 #define IPA_CMD_PRIM_VERSION_NO 0x01
5840
41
+struct qeth_ipa_caps {
42
+ u32 supported;
43
+ u32 enabled;
44
+};
45
+
46
+static inline bool qeth_ipa_caps_supported(struct qeth_ipa_caps *caps, u32 mask)
47
+{
48
+ return (caps->supported & mask) == mask;
49
+}
50
+
51
+static inline bool qeth_ipa_caps_enabled(struct qeth_ipa_caps *caps, u32 mask)
52
+{
53
+ return (caps->enabled & mask) == mask;
54
+}
55
+
56
+#define qeth_adp_supported(c, f) \
57
+ qeth_ipa_caps_supported(&c->options.adp, f)
58
+#define qeth_is_supported(c, f) \
59
+ qeth_ipa_caps_supported(&c->options.ipa4, f)
60
+#define qeth_is_supported6(c, f) \
61
+ qeth_ipa_caps_supported(&c->options.ipa6, f)
62
+#define qeth_is_ipafunc_supported(c, prot, f) \
63
+ ((prot == QETH_PROT_IPV6) ? qeth_is_supported6(c, f) : \
64
+ qeth_is_supported(c, f))
65
+
5966 enum qeth_card_types {
6067 QETH_CARD_TYPE_OSD = 1,
6168 QETH_CARD_TYPE_IQD = 5,
....@@ -65,7 +72,22 @@
6572 };
6673
6774 #define IS_IQD(card) ((card)->info.type == QETH_CARD_TYPE_IQD)
75
+#define IS_OSD(card) ((card)->info.type == QETH_CARD_TYPE_OSD)
76
+#define IS_OSM(card) ((card)->info.type == QETH_CARD_TYPE_OSM)
77
+
78
+#ifdef CONFIG_QETH_OSN
6879 #define IS_OSN(card) ((card)->info.type == QETH_CARD_TYPE_OSN)
80
+#else
81
+#define IS_OSN(card) false
82
+#endif
83
+
84
+#ifdef CONFIG_QETH_OSX
85
+#define IS_OSX(card) ((card)->info.type == QETH_CARD_TYPE_OSX)
86
+#else
87
+#define IS_OSX(card) false
88
+#endif
89
+
90
+#define IS_VM_NIC(card) ((card)->info.is_vm_nic)
6991
7092 #define QETH_MPC_DIFINFO_LEN_INDICATES_LINK_TYPE 0x18
7193 /* only the first two bytes are looked at in qeth_get_cardname_short */
....@@ -75,16 +97,13 @@
7597 QETH_LINK_TYPE_GBIT_ETH = 0x03,
7698 QETH_LINK_TYPE_OSN = 0x04,
7799 QETH_LINK_TYPE_10GBIT_ETH = 0x10,
100
+ QETH_LINK_TYPE_25GBIT_ETH = 0x12,
78101 QETH_LINK_TYPE_LANE_ETH100 = 0x81,
79102 QETH_LINK_TYPE_LANE_TR = 0x82,
80103 QETH_LINK_TYPE_LANE_ETH1000 = 0x83,
81104 QETH_LINK_TYPE_LANE = 0x88,
82105 };
83106
84
-/*
85
- * Routing stuff
86
- */
87
-#define RESET_ROUTING_FLAG 0x10 /* indicate that routing type shall be set */
88107 enum qeth_routing_types {
89108 /* TODO: set to bit flag used in IPA Command */
90109 NO_ROUTER = 0,
....@@ -212,7 +231,6 @@
212231 IPA_RC_LAN_OFFLINE = 0xe080,
213232 IPA_RC_VEPA_TO_VEB_TRANSITION = 0xe090,
214233 IPA_RC_INVALID_IP_VERSION2 = 0xf001,
215
- IPA_RC_ENOMEM = 0xfffe,
216234 IPA_RC_FFFF = 0xffff
217235 };
218236 /* for VNIC Characteristics */
....@@ -332,26 +350,26 @@
332350 CARD_INFO_PORTS_100M = 0x00000006,
333351 CARD_INFO_PORTS_1G = 0x00000007,
334352 CARD_INFO_PORTS_10G = 0x00000008,
353
+ CARD_INFO_PORTS_25G = 0x0000000A,
335354 };
336355
337356 /* (SET)DELIP(M) IPA stuff ***************************************************/
338357 struct qeth_ipacmd_setdelip4 {
339
- __u8 ip_addr[4];
340
- __u8 mask[4];
358
+ __be32 addr;
359
+ __be32 mask;
341360 __u32 flags;
342361 } __attribute__ ((packed));
343362
344363 struct qeth_ipacmd_setdelip6 {
345
- __u8 ip_addr[16];
346
- __u8 mask[16];
364
+ struct in6_addr addr;
365
+ struct in6_addr prefix;
347366 __u32 flags;
348367 } __attribute__ ((packed));
349368
350369 struct qeth_ipacmd_setdelipm {
351370 __u8 mac[6];
352371 __u8 padding[2];
353
- __u8 ip6[12];
354
- __u8 ip4[4];
372
+ struct in6_addr ip;
355373 } __attribute__ ((packed));
356374
357375 struct qeth_ipacmd_layer2setdelmac {
....@@ -363,9 +381,7 @@
363381 __u16 vlan_id;
364382 } __attribute__ ((packed));
365383
366
-
367384 struct qeth_ipacmd_setassparms_hdr {
368
- __u32 assist_no;
369385 __u16 length;
370386 __u16 command_code;
371387 __u16 return_code;
....@@ -399,24 +415,30 @@
399415 QETH_IPA_CHECKSUM_LP2LP = 0x0020
400416 };
401417
402
-/* IPA Assist checksum offload reply layout. */
403
-struct qeth_checksum_cmd {
404
- __u32 supported;
405
- __u32 enabled;
406
-} __packed;
418
+enum qeth_ipa_large_send_caps {
419
+ QETH_IPA_LARGE_SEND_TCP = 0x00000001,
420
+};
421
+
422
+struct qeth_tso_start_data {
423
+ u32 mss;
424
+ u32 supported;
425
+};
407426
408427 /* SETASSPARMS IPA Command: */
409428 struct qeth_ipacmd_setassparms {
429
+ u32 assist_no;
410430 struct qeth_ipacmd_setassparms_hdr hdr;
411431 union {
412432 __u32 flags_32bit;
413
- struct qeth_checksum_cmd chksum;
414
- struct qeth_arp_cache_entry add_arp_entry;
433
+ struct qeth_ipa_caps caps;
434
+ struct qeth_arp_cache_entry arp_entry;
415435 struct qeth_arp_query_data query_arp;
416
- __u8 ip[16];
436
+ struct qeth_tso_start_data tso;
417437 } data;
418438 } __attribute__ ((packed));
419439
440
+#define SETASS_DATA_SIZEOF(field) sizeof_field(struct qeth_ipacmd_setassparms,\
441
+ data.field)
420442
421443 /* SETRTG IPA Command: ****************************************************/
422444 struct qeth_set_routing {
....@@ -501,19 +523,21 @@
501523 __u8 reserved3[8];
502524 };
503525
526
+#define QETH_SETADP_FLAGS_VIRTUAL_MAC 0x80 /* for CHANGE_ADDR_READ_MAC */
527
+
504528 struct qeth_ipacmd_setadpparms_hdr {
505
- __u32 supp_hw_cmds;
506
- __u32 reserved1;
507
- __u16 cmdlength;
508
- __u16 reserved2;
509
- __u32 command_code;
510
- __u16 return_code;
511
- __u8 used_total;
512
- __u8 seq_no;
513
- __u32 reserved3;
514
-} __attribute__ ((packed));
529
+ u16 cmdlength;
530
+ u16 reserved2;
531
+ u32 command_code;
532
+ u16 return_code;
533
+ u8 used_total;
534
+ u8 seq_no;
535
+ u8 flags;
536
+ u8 reserved3[3];
537
+};
515538
516539 struct qeth_ipacmd_setadpparms {
540
+ struct qeth_ipa_caps hw_cmds;
517541 struct qeth_ipacmd_setadpparms_hdr hdr;
518542 union {
519543 struct qeth_query_cmds_supp query_cmds_supp;
....@@ -527,10 +551,14 @@
527551 } data;
528552 } __attribute__ ((packed));
529553
554
+#define SETADP_DATA_SIZEOF(field) sizeof_field(struct qeth_ipacmd_setadpparms,\
555
+ data.field)
556
+
530557 /* CREATE_ADDR IPA Command: ***********************************************/
531558 struct qeth_create_destroy_address {
532
- __u8 unique_id[8];
533
-} __attribute__ ((packed));
559
+ u8 mac_addr[ETH_ALEN];
560
+ u16 uid;
561
+};
534562
535563 /* SET DIAGNOSTIC ASSIST IPA Command: *************************************/
536564
....@@ -573,6 +601,11 @@
573601 __u8 cdata[64];
574602 } __attribute__ ((packed));
575603
604
+#define DIAG_HDR_LEN offsetofend(struct qeth_ipacmd_diagass, ext)
605
+#define DIAG_SUB_HDR_LEN (offsetofend(struct qeth_ipacmd_diagass, ext) -\
606
+ offsetof(struct qeth_ipacmd_diagass, \
607
+ subcmd_len))
608
+
576609 /* VNIC Characteristics IPA Command: *****************************************/
577610 /* IPA commands/sub commands for VNICC */
578611 #define IPA_VNICC_QUERY_CHARS 0x00000000L
....@@ -599,12 +632,6 @@
599632
600633 /* VNICC header */
601634 struct qeth_ipacmd_vnicc_hdr {
602
- u32 sup;
603
- u32 cur;
604
-};
605
-
606
-/* VNICC sub command header */
607
-struct qeth_vnicc_sub_hdr {
608635 u16 data_length;
609636 u16 reserved;
610637 u32 sub_command;
....@@ -629,14 +656,17 @@
629656
630657 /* complete VNICC IPA command message */
631658 struct qeth_ipacmd_vnicc {
659
+ struct qeth_ipa_caps vnicc_cmds;
632660 struct qeth_ipacmd_vnicc_hdr hdr;
633
- struct qeth_vnicc_sub_hdr sub_hdr;
634661 union {
635662 struct qeth_vnicc_query_cmds query_cmds;
636663 struct qeth_vnicc_set_char set_char;
637664 struct qeth_vnicc_getset_timeout getset_timeout;
638
- };
665
+ } data;
639666 };
667
+
668
+#define VNICC_DATA_SIZEOF(field) sizeof_field(struct qeth_ipacmd_vnicc,\
669
+ data.field)
640670
641671 /* SETBRIDGEPORT IPA Command: *********************************************/
642672 enum qeth_ipa_sbp_cmd {
....@@ -663,8 +693,6 @@
663693 } __packed;
664694
665695 struct qeth_ipacmd_sbp_hdr {
666
- __u32 supported_sbp_cmds;
667
- __u32 enabled_sbp_cmds;
668696 __u16 cmdlength;
669697 __u16 reserved1;
670698 __u32 command_code;
....@@ -679,14 +707,8 @@
679707 __u32 reserved;
680708 } __packed;
681709
682
-struct qeth_sbp_reset_role {
683
-} __packed;
684
-
685710 struct qeth_sbp_set_primary {
686711 struct net_if_token token;
687
-} __packed;
688
-
689
-struct qeth_sbp_set_secondary {
690712 } __packed;
691713
692714 struct qeth_sbp_port_entry {
....@@ -697,15 +719,8 @@
697719 struct net_if_token token;
698720 } __packed;
699721
700
-struct qeth_sbp_query_ports {
701
- __u8 primary_bp_supported;
702
- __u8 secondary_bp_supported;
703
- __u8 num_entries;
704
- __u8 entry_length;
705
- struct qeth_sbp_port_entry entry[];
706
-} __packed;
707
-
708
-struct qeth_sbp_state_change {
722
+/* For IPA_SBP_QUERY_BRIDGE_PORTS, IPA_SBP_BRIDGE_PORT_STATE_CHANGE */
723
+struct qeth_sbp_port_data {
709724 __u8 primary_bp_supported;
710725 __u8 secondary_bp_supported;
711726 __u8 num_entries;
....@@ -714,16 +729,17 @@
714729 } __packed;
715730
716731 struct qeth_ipacmd_setbridgeport {
732
+ struct qeth_ipa_caps sbp_cmds;
717733 struct qeth_ipacmd_sbp_hdr hdr;
718734 union {
719735 struct qeth_sbp_query_cmds_supp query_cmds_supp;
720
- struct qeth_sbp_reset_role reset_role;
721736 struct qeth_sbp_set_primary set_primary;
722
- struct qeth_sbp_set_secondary set_secondary;
723
- struct qeth_sbp_query_ports query_ports;
724
- struct qeth_sbp_state_change state_change;
737
+ struct qeth_sbp_port_data port_data;
725738 } data;
726739 } __packed;
740
+
741
+#define SBP_DATA_SIZEOF(field) sizeof_field(struct qeth_ipacmd_setbridgeport,\
742
+ data.field)
727743
728744 /* ADDRESS_CHANGE_NOTIFICATION adapter-initiated "command" *******************/
729745 /* Bitmask for entry->change_code. Both bits may be raised. */
....@@ -748,6 +764,29 @@
748764 struct qeth_ipacmd_addr_change_entry entry[];
749765 } __packed;
750766
767
+/* [UN]REGISTER_LOCAL_ADDRESS notifications */
768
+struct qeth_ipacmd_local_addr4 {
769
+ __be32 addr;
770
+ u32 flags;
771
+};
772
+
773
+struct qeth_ipacmd_local_addrs4 {
774
+ u32 count;
775
+ u32 addr_length;
776
+ struct qeth_ipacmd_local_addr4 addrs[];
777
+};
778
+
779
+struct qeth_ipacmd_local_addr6 {
780
+ struct in6_addr addr;
781
+ u32 flags;
782
+};
783
+
784
+struct qeth_ipacmd_local_addrs6 {
785
+ u32 count;
786
+ u32 addr_length;
787
+ struct qeth_ipacmd_local_addr6 addrs[];
788
+};
789
+
751790 /* Header for each IPA command */
752791 struct qeth_ipacmd_hdr {
753792 __u8 command;
....@@ -759,8 +798,7 @@
759798 __u8 prim_version_no;
760799 __u8 param_count;
761800 __u16 prot_version;
762
- __u32 ipa_supported;
763
- __u32 ipa_enabled;
801
+ struct qeth_ipa_caps assists;
764802 } __attribute__ ((packed));
765803
766804 /* The IPA command itself */
....@@ -780,8 +818,12 @@
780818 struct qeth_ipacmd_setbridgeport sbp;
781819 struct qeth_ipacmd_addr_change addrchange;
782820 struct qeth_ipacmd_vnicc vnicc;
821
+ struct qeth_ipacmd_local_addrs4 local_addrs4;
822
+ struct qeth_ipacmd_local_addrs6 local_addrs6;
783823 } data;
784824 } __attribute__ ((packed));
825
+
826
+#define IPA_DATA_SIZEOF(field) sizeof_field(struct qeth_ipa_cmd, data.field)
785827
786828 /*
787829 * special command for ARP processing.
....@@ -800,16 +842,6 @@
800842 extern const char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc);
801843 extern const char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd);
802844
803
-#define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
804
- sizeof(struct qeth_ipacmd_setassparms_hdr))
805
-#define QETH_IPA_ARP_DATA_POS(buffer) (buffer + IPA_PDU_HEADER_SIZE + \
806
- QETH_SETASS_BASE_LEN)
807
-#define QETH_SETADP_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
808
- sizeof(struct qeth_ipacmd_setadpparms_hdr))
809
-#define QETH_SNMP_SETADP_CMDLENGTH 16
810
-
811
-#define QETH_ARP_DATA_SIZE 3968
812
-#define QETH_ARP_CMD_LEN (QETH_ARP_DATA_SIZE + 8)
813845 /* Helper functions */
814846 #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \
815847 (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY))
....@@ -818,7 +850,7 @@
818850 /* END OF IP Assist related definitions */
819851 /*****************************************************************************/
820852
821
-extern unsigned char CM_ENABLE[];
853
+extern const unsigned char CM_ENABLE[];
822854 #define CM_ENABLE_SIZE 0x63
823855 #define QETH_CM_ENABLE_ISSUER_RM_TOKEN(buffer) (buffer + 0x2c)
824856 #define QETH_CM_ENABLE_FILTER_TOKEN(buffer) (buffer + 0x53)
....@@ -828,7 +860,7 @@
828860 (PDU_ENCAPSULATION(buffer) + 0x13)
829861
830862
831
-extern unsigned char CM_SETUP[];
863
+extern const unsigned char CM_SETUP[];
832864 #define CM_SETUP_SIZE 0x64
833865 #define QETH_CM_SETUP_DEST_ADDR(buffer) (buffer + 0x2c)
834866 #define QETH_CM_SETUP_CONNECTION_TOKEN(buffer) (buffer + 0x51)
....@@ -837,7 +869,7 @@
837869 #define QETH_CM_SETUP_RESP_DEST_ADDR(buffer) \
838870 (PDU_ENCAPSULATION(buffer) + 0x1a)
839871
840
-extern unsigned char ULP_ENABLE[];
872
+extern const unsigned char ULP_ENABLE[];
841873 #define ULP_ENABLE_SIZE 0x6b
842874 #define QETH_ULP_ENABLE_LINKNUM(buffer) (buffer + 0x61)
843875 #define QETH_ULP_ENABLE_DEST_ADDR(buffer) (buffer + 0x2c)
....@@ -858,7 +890,7 @@
858890 #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer + 0x50)
859891 #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer + 0x19)
860892
861
-extern unsigned char ULP_SETUP[];
893
+extern const unsigned char ULP_SETUP[];
862894 #define ULP_SETUP_SIZE 0x6c
863895 #define QETH_ULP_SETUP_DEST_ADDR(buffer) (buffer + 0x2c)
864896 #define QETH_ULP_SETUP_CONNECTION_TOKEN(buffer) (buffer + 0x51)
....@@ -870,7 +902,7 @@
870902 (PDU_ENCAPSULATION(buffer) + 0x1a)
871903
872904
873
-extern unsigned char DM_ACT[];
905
+extern const unsigned char DM_ACT[];
874906 #define DM_ACT_SIZE 0x55
875907 #define QETH_DM_ACT_DEST_ADDR(buffer) (buffer + 0x2c)
876908 #define QETH_DM_ACT_CONNECTION_TOKEN(buffer) (buffer + 0x51)
....@@ -881,12 +913,12 @@
881913 #define QETH_PDU_HEADER_SEQ_NO(buffer) (buffer + 0x1c)
882914 #define QETH_PDU_HEADER_ACK_SEQ_NO(buffer) (buffer + 0x20)
883915
884
-extern unsigned char IDX_ACTIVATE_READ[];
885
-extern unsigned char IDX_ACTIVATE_WRITE[];
886
-
916
+extern const unsigned char IDX_ACTIVATE_READ[];
917
+extern const unsigned char IDX_ACTIVATE_WRITE[];
887918 #define IDX_ACTIVATE_SIZE 0x22
888919 #define QETH_IDX_ACT_PNO(buffer) (buffer+0x0b)
889920 #define QETH_IDX_ACT_ISSUER_RM_TOKEN(buffer) (buffer + 0x0c)
921
+#define QETH_IDX_ACT_INVAL_FRAME 0x40
890922 #define QETH_IDX_NO_PORTNAME_REQUIRED(buffer) ((buffer)[0x0b] & 0x80)
891923 #define QETH_IDX_ACT_FUNC_LEVEL(buffer) (buffer + 0x10)
892924 #define QETH_IDX_ACT_DATASET_NAME(buffer) (buffer + 0x16)
....@@ -899,6 +931,11 @@
899931 #define QETH_IDX_ACT_ERR_AUTH 0x1E
900932 #define QETH_IDX_ACT_ERR_AUTH_USER 0x20
901933
934
+#define QETH_IDX_TERMINATE 0xc0
935
+#define QETH_IDX_TERMINATE_MASK 0xc0
936
+#define QETH_IDX_TERM_BAD_TRANSPORT 0x41
937
+#define QETH_IDX_TERM_BAD_TRANSPORT_VM 0xf6
938
+
902939 #define PDU_ENCAPSULATION(buffer) \
903940 (buffer + *(buffer + (*(buffer + 0x0b)) + \
904941 *(buffer + *(buffer + 0x0b) + 0x11) + 0x07))