xref: /kernel/linux/linux-5.10/net/ncsi/ncsi-pkt.h (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright Gavin Shan, IBM Corporation 2016.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef __NCSI_PKT_H__
78c2ecf20Sopenharmony_ci#define __NCSI_PKT_H__
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cistruct ncsi_pkt_hdr {
108c2ecf20Sopenharmony_ci	unsigned char mc_id;        /* Management controller ID */
118c2ecf20Sopenharmony_ci	unsigned char revision;     /* NCSI version - 0x01      */
128c2ecf20Sopenharmony_ci	unsigned char reserved;     /* Reserved                 */
138c2ecf20Sopenharmony_ci	unsigned char id;           /* Packet sequence number   */
148c2ecf20Sopenharmony_ci	unsigned char type;         /* Packet type              */
158c2ecf20Sopenharmony_ci	unsigned char channel;      /* Network controller ID    */
168c2ecf20Sopenharmony_ci	__be16        length;       /* Payload length           */
178c2ecf20Sopenharmony_ci	__be32        reserved1[2]; /* Reserved                 */
188c2ecf20Sopenharmony_ci};
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct ncsi_cmd_pkt_hdr {
218c2ecf20Sopenharmony_ci	struct ncsi_pkt_hdr common; /* Common NCSI packet header */
228c2ecf20Sopenharmony_ci};
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistruct ncsi_rsp_pkt_hdr {
258c2ecf20Sopenharmony_ci	struct ncsi_pkt_hdr common; /* Common NCSI packet header */
268c2ecf20Sopenharmony_ci	__be16              code;   /* Response code             */
278c2ecf20Sopenharmony_ci	__be16              reason; /* Response reason           */
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistruct ncsi_aen_pkt_hdr {
318c2ecf20Sopenharmony_ci	struct ncsi_pkt_hdr common;       /* Common NCSI packet header */
328c2ecf20Sopenharmony_ci	unsigned char       reserved2[3]; /* Reserved                  */
338c2ecf20Sopenharmony_ci	unsigned char       type;         /* AEN packet type           */
348c2ecf20Sopenharmony_ci};
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* NCSI common command packet */
378c2ecf20Sopenharmony_cistruct ncsi_cmd_pkt {
388c2ecf20Sopenharmony_ci	struct ncsi_cmd_pkt_hdr cmd;      /* Command header */
398c2ecf20Sopenharmony_ci	__be32                  checksum; /* Checksum       */
408c2ecf20Sopenharmony_ci	unsigned char           pad[26];
418c2ecf20Sopenharmony_ci};
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cistruct ncsi_rsp_pkt {
448c2ecf20Sopenharmony_ci	struct ncsi_rsp_pkt_hdr rsp;      /* Response header */
458c2ecf20Sopenharmony_ci	__be32                  checksum; /* Checksum        */
468c2ecf20Sopenharmony_ci	unsigned char           pad[22];
478c2ecf20Sopenharmony_ci};
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* Select Package */
508c2ecf20Sopenharmony_cistruct ncsi_cmd_sp_pkt {
518c2ecf20Sopenharmony_ci	struct ncsi_cmd_pkt_hdr cmd;            /* Command header */
528c2ecf20Sopenharmony_ci	unsigned char           reserved[3];    /* Reserved       */
538c2ecf20Sopenharmony_ci	unsigned char           hw_arbitration; /* HW arbitration */
548c2ecf20Sopenharmony_ci	__be32                  checksum;       /* Checksum       */
558c2ecf20Sopenharmony_ci	unsigned char           pad[22];
568c2ecf20Sopenharmony_ci};
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci/* Disable Channel */
598c2ecf20Sopenharmony_cistruct ncsi_cmd_dc_pkt {
608c2ecf20Sopenharmony_ci	struct ncsi_cmd_pkt_hdr cmd;         /* Command header  */
618c2ecf20Sopenharmony_ci	unsigned char           reserved[3]; /* Reserved        */
628c2ecf20Sopenharmony_ci	unsigned char           ald;         /* Allow link down */
638c2ecf20Sopenharmony_ci	__be32                  checksum;    /* Checksum        */
648c2ecf20Sopenharmony_ci	unsigned char           pad[22];
658c2ecf20Sopenharmony_ci};
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci/* Reset Channel */
688c2ecf20Sopenharmony_cistruct ncsi_cmd_rc_pkt {
698c2ecf20Sopenharmony_ci	struct ncsi_cmd_pkt_hdr cmd;      /* Command header */
708c2ecf20Sopenharmony_ci	__be32                  reserved; /* Reserved       */
718c2ecf20Sopenharmony_ci	__be32                  checksum; /* Checksum       */
728c2ecf20Sopenharmony_ci	unsigned char           pad[22];
738c2ecf20Sopenharmony_ci};
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/* AEN Enable */
768c2ecf20Sopenharmony_cistruct ncsi_cmd_ae_pkt {
778c2ecf20Sopenharmony_ci	struct ncsi_cmd_pkt_hdr cmd;         /* Command header   */
788c2ecf20Sopenharmony_ci	unsigned char           reserved[3]; /* Reserved         */
798c2ecf20Sopenharmony_ci	unsigned char           mc_id;       /* MC ID            */
808c2ecf20Sopenharmony_ci	__be32                  mode;        /* AEN working mode */
818c2ecf20Sopenharmony_ci	__be32                  checksum;    /* Checksum         */
828c2ecf20Sopenharmony_ci	unsigned char           pad[18];
838c2ecf20Sopenharmony_ci};
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/* Set Link */
868c2ecf20Sopenharmony_cistruct ncsi_cmd_sl_pkt {
878c2ecf20Sopenharmony_ci	struct ncsi_cmd_pkt_hdr cmd;      /* Command header    */
888c2ecf20Sopenharmony_ci	__be32                  mode;     /* Link working mode */
898c2ecf20Sopenharmony_ci	__be32                  oem_mode; /* OEM link mode     */
908c2ecf20Sopenharmony_ci	__be32                  checksum; /* Checksum          */
918c2ecf20Sopenharmony_ci	unsigned char           pad[18];
928c2ecf20Sopenharmony_ci};
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci/* Set VLAN Filter */
958c2ecf20Sopenharmony_cistruct ncsi_cmd_svf_pkt {
968c2ecf20Sopenharmony_ci	struct ncsi_cmd_pkt_hdr cmd;       /* Command header    */
978c2ecf20Sopenharmony_ci	__be16                  reserved;  /* Reserved          */
988c2ecf20Sopenharmony_ci	__be16                  vlan;      /* VLAN ID           */
998c2ecf20Sopenharmony_ci	__be16                  reserved1; /* Reserved          */
1008c2ecf20Sopenharmony_ci	unsigned char           index;     /* VLAN table index  */
1018c2ecf20Sopenharmony_ci	unsigned char           enable;    /* Enable or disable */
1028c2ecf20Sopenharmony_ci	__be32                  checksum;  /* Checksum          */
1038c2ecf20Sopenharmony_ci	unsigned char           pad[18];
1048c2ecf20Sopenharmony_ci};
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* Enable VLAN */
1078c2ecf20Sopenharmony_cistruct ncsi_cmd_ev_pkt {
1088c2ecf20Sopenharmony_ci	struct ncsi_cmd_pkt_hdr cmd;         /* Command header   */
1098c2ecf20Sopenharmony_ci	unsigned char           reserved[3]; /* Reserved         */
1108c2ecf20Sopenharmony_ci	unsigned char           mode;        /* VLAN filter mode */
1118c2ecf20Sopenharmony_ci	__be32                  checksum;    /* Checksum         */
1128c2ecf20Sopenharmony_ci	unsigned char           pad[22];
1138c2ecf20Sopenharmony_ci};
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/* Set MAC Address */
1168c2ecf20Sopenharmony_cistruct ncsi_cmd_sma_pkt {
1178c2ecf20Sopenharmony_ci	struct ncsi_cmd_pkt_hdr cmd;      /* Command header          */
1188c2ecf20Sopenharmony_ci	unsigned char           mac[6];   /* MAC address             */
1198c2ecf20Sopenharmony_ci	unsigned char           index;    /* MAC table index         */
1208c2ecf20Sopenharmony_ci	unsigned char           at_e;     /* Addr type and operation */
1218c2ecf20Sopenharmony_ci	__be32                  checksum; /* Checksum                */
1228c2ecf20Sopenharmony_ci	unsigned char           pad[18];
1238c2ecf20Sopenharmony_ci};
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/* Enable Broadcast Filter */
1268c2ecf20Sopenharmony_cistruct ncsi_cmd_ebf_pkt {
1278c2ecf20Sopenharmony_ci	struct ncsi_cmd_pkt_hdr cmd;      /* Command header */
1288c2ecf20Sopenharmony_ci	__be32                  mode;     /* Filter mode    */
1298c2ecf20Sopenharmony_ci	__be32                  checksum; /* Checksum       */
1308c2ecf20Sopenharmony_ci	unsigned char           pad[22];
1318c2ecf20Sopenharmony_ci};
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci/* Enable Global Multicast Filter */
1348c2ecf20Sopenharmony_cistruct ncsi_cmd_egmf_pkt {
1358c2ecf20Sopenharmony_ci	struct ncsi_cmd_pkt_hdr cmd;      /* Command header */
1368c2ecf20Sopenharmony_ci	__be32                  mode;     /* Global MC mode */
1378c2ecf20Sopenharmony_ci	__be32                  checksum; /* Checksum       */
1388c2ecf20Sopenharmony_ci	unsigned char           pad[22];
1398c2ecf20Sopenharmony_ci};
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci/* Set NCSI Flow Control */
1428c2ecf20Sopenharmony_cistruct ncsi_cmd_snfc_pkt {
1438c2ecf20Sopenharmony_ci	struct ncsi_cmd_pkt_hdr cmd;         /* Command header    */
1448c2ecf20Sopenharmony_ci	unsigned char           reserved[3]; /* Reserved          */
1458c2ecf20Sopenharmony_ci	unsigned char           mode;        /* Flow control mode */
1468c2ecf20Sopenharmony_ci	__be32                  checksum;    /* Checksum          */
1478c2ecf20Sopenharmony_ci	unsigned char           pad[22];
1488c2ecf20Sopenharmony_ci};
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci/* OEM Request Command as per NCSI Specification */
1518c2ecf20Sopenharmony_cistruct ncsi_cmd_oem_pkt {
1528c2ecf20Sopenharmony_ci	struct ncsi_cmd_pkt_hdr cmd;         /* Command header    */
1538c2ecf20Sopenharmony_ci	__be32                  mfr_id;      /* Manufacture ID    */
1548c2ecf20Sopenharmony_ci	unsigned char           data[];      /* OEM Payload Data  */
1558c2ecf20Sopenharmony_ci};
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/* OEM Response Packet as per NCSI Specification */
1588c2ecf20Sopenharmony_cistruct ncsi_rsp_oem_pkt {
1598c2ecf20Sopenharmony_ci	struct ncsi_rsp_pkt_hdr rsp;         /* Command header    */
1608c2ecf20Sopenharmony_ci	__be32                  mfr_id;      /* Manufacture ID    */
1618c2ecf20Sopenharmony_ci	unsigned char           data[];      /* Payload data      */
1628c2ecf20Sopenharmony_ci};
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci/* Mellanox Response Data */
1658c2ecf20Sopenharmony_cistruct ncsi_rsp_oem_mlx_pkt {
1668c2ecf20Sopenharmony_ci	unsigned char           cmd_rev;     /* Command Revision  */
1678c2ecf20Sopenharmony_ci	unsigned char           cmd;         /* Command ID        */
1688c2ecf20Sopenharmony_ci	unsigned char           param;       /* Parameter         */
1698c2ecf20Sopenharmony_ci	unsigned char           optional;    /* Optional data     */
1708c2ecf20Sopenharmony_ci	unsigned char           data[];      /* Data              */
1718c2ecf20Sopenharmony_ci};
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci/* Broadcom Response Data */
1748c2ecf20Sopenharmony_cistruct ncsi_rsp_oem_bcm_pkt {
1758c2ecf20Sopenharmony_ci	unsigned char           ver;         /* Payload Version   */
1768c2ecf20Sopenharmony_ci	unsigned char           type;        /* OEM Command type  */
1778c2ecf20Sopenharmony_ci	__be16                  len;         /* Payload Length    */
1788c2ecf20Sopenharmony_ci	unsigned char           data[];      /* Cmd specific Data */
1798c2ecf20Sopenharmony_ci};
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci/* Get Link Status */
1828c2ecf20Sopenharmony_cistruct ncsi_rsp_gls_pkt {
1838c2ecf20Sopenharmony_ci	struct ncsi_rsp_pkt_hdr rsp;        /* Response header   */
1848c2ecf20Sopenharmony_ci	__be32                  status;     /* Link status       */
1858c2ecf20Sopenharmony_ci	__be32                  other;      /* Other indications */
1868c2ecf20Sopenharmony_ci	__be32                  oem_status; /* OEM link status   */
1878c2ecf20Sopenharmony_ci	__be32                  checksum;
1888c2ecf20Sopenharmony_ci	unsigned char           pad[10];
1898c2ecf20Sopenharmony_ci};
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci/* Get Version ID */
1928c2ecf20Sopenharmony_cistruct ncsi_rsp_gvi_pkt {
1938c2ecf20Sopenharmony_ci	struct ncsi_rsp_pkt_hdr rsp;          /* Response header */
1948c2ecf20Sopenharmony_ci	unsigned char           major;        /* NCSI version major */
1958c2ecf20Sopenharmony_ci	unsigned char           minor;        /* NCSI version minor */
1968c2ecf20Sopenharmony_ci	unsigned char           update;       /* NCSI version update */
1978c2ecf20Sopenharmony_ci	unsigned char           alpha1;       /* NCSI version alpha1 */
1988c2ecf20Sopenharmony_ci	unsigned char           reserved[3];  /* Reserved        */
1998c2ecf20Sopenharmony_ci	unsigned char           alpha2;       /* NCSI version alpha2 */
2008c2ecf20Sopenharmony_ci	unsigned char           fw_name[12];  /* f/w name string */
2018c2ecf20Sopenharmony_ci	__be32                  fw_version;   /* f/w version     */
2028c2ecf20Sopenharmony_ci	__be16                  pci_ids[4];   /* PCI IDs         */
2038c2ecf20Sopenharmony_ci	__be32                  mf_id;        /* Manufacture ID  */
2048c2ecf20Sopenharmony_ci	__be32                  checksum;
2058c2ecf20Sopenharmony_ci};
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci/* Get Capabilities */
2088c2ecf20Sopenharmony_cistruct ncsi_rsp_gc_pkt {
2098c2ecf20Sopenharmony_ci	struct ncsi_rsp_pkt_hdr rsp;         /* Response header   */
2108c2ecf20Sopenharmony_ci	__be32                  cap;         /* Capabilities      */
2118c2ecf20Sopenharmony_ci	__be32                  bc_cap;      /* Broadcast cap     */
2128c2ecf20Sopenharmony_ci	__be32                  mc_cap;      /* Multicast cap     */
2138c2ecf20Sopenharmony_ci	__be32                  buf_cap;     /* Buffering cap     */
2148c2ecf20Sopenharmony_ci	__be32                  aen_cap;     /* AEN cap           */
2158c2ecf20Sopenharmony_ci	unsigned char           vlan_cnt;    /* VLAN filter count */
2168c2ecf20Sopenharmony_ci	unsigned char           mixed_cnt;   /* Mix filter count  */
2178c2ecf20Sopenharmony_ci	unsigned char           mc_cnt;      /* MC filter count   */
2188c2ecf20Sopenharmony_ci	unsigned char           uc_cnt;      /* UC filter count   */
2198c2ecf20Sopenharmony_ci	unsigned char           reserved[2]; /* Reserved          */
2208c2ecf20Sopenharmony_ci	unsigned char           vlan_mode;   /* VLAN mode         */
2218c2ecf20Sopenharmony_ci	unsigned char           channel_cnt; /* Channel count     */
2228c2ecf20Sopenharmony_ci	__be32                  checksum;    /* Checksum          */
2238c2ecf20Sopenharmony_ci};
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci/* Get Parameters */
2268c2ecf20Sopenharmony_cistruct ncsi_rsp_gp_pkt {
2278c2ecf20Sopenharmony_ci	struct ncsi_rsp_pkt_hdr rsp;          /* Response header       */
2288c2ecf20Sopenharmony_ci	unsigned char           mac_cnt;      /* Number of MAC addr    */
2298c2ecf20Sopenharmony_ci	unsigned char           reserved[2];  /* Reserved              */
2308c2ecf20Sopenharmony_ci	unsigned char           mac_enable;   /* MAC addr enable flags */
2318c2ecf20Sopenharmony_ci	unsigned char           vlan_cnt;     /* VLAN tag count        */
2328c2ecf20Sopenharmony_ci	unsigned char           reserved1;    /* Reserved              */
2338c2ecf20Sopenharmony_ci	__be16                  vlan_enable;  /* VLAN tag enable flags */
2348c2ecf20Sopenharmony_ci	__be32                  link_mode;    /* Link setting          */
2358c2ecf20Sopenharmony_ci	__be32                  bc_mode;      /* BC filter mode        */
2368c2ecf20Sopenharmony_ci	__be32                  valid_modes;  /* Valid mode parameters */
2378c2ecf20Sopenharmony_ci	unsigned char           vlan_mode;    /* VLAN mode             */
2388c2ecf20Sopenharmony_ci	unsigned char           fc_mode;      /* Flow control mode     */
2398c2ecf20Sopenharmony_ci	unsigned char           reserved2[2]; /* Reserved              */
2408c2ecf20Sopenharmony_ci	__be32                  aen_mode;     /* AEN mode              */
2418c2ecf20Sopenharmony_ci	unsigned char           mac[6];       /* Supported MAC addr    */
2428c2ecf20Sopenharmony_ci	__be16                  vlan;         /* Supported VLAN tags   */
2438c2ecf20Sopenharmony_ci	__be32                  checksum;     /* Checksum              */
2448c2ecf20Sopenharmony_ci};
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci/* Get Controller Packet Statistics */
2478c2ecf20Sopenharmony_cistruct ncsi_rsp_gcps_pkt {
2488c2ecf20Sopenharmony_ci	struct ncsi_rsp_pkt_hdr rsp;            /* Response header            */
2498c2ecf20Sopenharmony_ci	__be32                  cnt_hi;         /* Counter cleared            */
2508c2ecf20Sopenharmony_ci	__be32                  cnt_lo;         /* Counter cleared            */
2518c2ecf20Sopenharmony_ci	__be32                  rx_bytes;       /* Rx bytes                   */
2528c2ecf20Sopenharmony_ci	__be32                  tx_bytes;       /* Tx bytes                   */
2538c2ecf20Sopenharmony_ci	__be32                  rx_uc_pkts;     /* Rx UC packets              */
2548c2ecf20Sopenharmony_ci	__be32                  rx_mc_pkts;     /* Rx MC packets              */
2558c2ecf20Sopenharmony_ci	__be32                  rx_bc_pkts;     /* Rx BC packets              */
2568c2ecf20Sopenharmony_ci	__be32                  tx_uc_pkts;     /* Tx UC packets              */
2578c2ecf20Sopenharmony_ci	__be32                  tx_mc_pkts;     /* Tx MC packets              */
2588c2ecf20Sopenharmony_ci	__be32                  tx_bc_pkts;     /* Tx BC packets              */
2598c2ecf20Sopenharmony_ci	__be32                  fcs_err;        /* FCS errors                 */
2608c2ecf20Sopenharmony_ci	__be32                  align_err;      /* Alignment errors           */
2618c2ecf20Sopenharmony_ci	__be32                  false_carrier;  /* False carrier detection    */
2628c2ecf20Sopenharmony_ci	__be32                  runt_pkts;      /* Rx runt packets            */
2638c2ecf20Sopenharmony_ci	__be32                  jabber_pkts;    /* Rx jabber packets          */
2648c2ecf20Sopenharmony_ci	__be32                  rx_pause_xon;   /* Rx pause XON frames        */
2658c2ecf20Sopenharmony_ci	__be32                  rx_pause_xoff;  /* Rx XOFF frames             */
2668c2ecf20Sopenharmony_ci	__be32                  tx_pause_xon;   /* Tx XON frames              */
2678c2ecf20Sopenharmony_ci	__be32                  tx_pause_xoff;  /* Tx XOFF frames             */
2688c2ecf20Sopenharmony_ci	__be32                  tx_s_collision; /* Single collision frames    */
2698c2ecf20Sopenharmony_ci	__be32                  tx_m_collision; /* Multiple collision frames  */
2708c2ecf20Sopenharmony_ci	__be32                  l_collision;    /* Late collision frames      */
2718c2ecf20Sopenharmony_ci	__be32                  e_collision;    /* Excessive collision frames */
2728c2ecf20Sopenharmony_ci	__be32                  rx_ctl_frames;  /* Rx control frames          */
2738c2ecf20Sopenharmony_ci	__be32                  rx_64_frames;   /* Rx 64-bytes frames         */
2748c2ecf20Sopenharmony_ci	__be32                  rx_127_frames;  /* Rx 65-127 bytes frames     */
2758c2ecf20Sopenharmony_ci	__be32                  rx_255_frames;  /* Rx 128-255 bytes frames    */
2768c2ecf20Sopenharmony_ci	__be32                  rx_511_frames;  /* Rx 256-511 bytes frames    */
2778c2ecf20Sopenharmony_ci	__be32                  rx_1023_frames; /* Rx 512-1023 bytes frames   */
2788c2ecf20Sopenharmony_ci	__be32                  rx_1522_frames; /* Rx 1024-1522 bytes frames  */
2798c2ecf20Sopenharmony_ci	__be32                  rx_9022_frames; /* Rx 1523-9022 bytes frames  */
2808c2ecf20Sopenharmony_ci	__be32                  tx_64_frames;   /* Tx 64-bytes frames         */
2818c2ecf20Sopenharmony_ci	__be32                  tx_127_frames;  /* Tx 65-127 bytes frames     */
2828c2ecf20Sopenharmony_ci	__be32                  tx_255_frames;  /* Tx 128-255 bytes frames    */
2838c2ecf20Sopenharmony_ci	__be32                  tx_511_frames;  /* Tx 256-511 bytes frames    */
2848c2ecf20Sopenharmony_ci	__be32                  tx_1023_frames; /* Tx 512-1023 bytes frames   */
2858c2ecf20Sopenharmony_ci	__be32                  tx_1522_frames; /* Tx 1024-1522 bytes frames  */
2868c2ecf20Sopenharmony_ci	__be32                  tx_9022_frames; /* Tx 1523-9022 bytes frames  */
2878c2ecf20Sopenharmony_ci	__be32                  rx_valid_bytes; /* Rx valid bytes             */
2888c2ecf20Sopenharmony_ci	__be32                  rx_runt_pkts;   /* Rx error runt packets      */
2898c2ecf20Sopenharmony_ci	__be32                  rx_jabber_pkts; /* Rx error jabber packets    */
2908c2ecf20Sopenharmony_ci	__be32                  checksum;       /* Checksum                   */
2918c2ecf20Sopenharmony_ci};
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci/* Get NCSI Statistics */
2948c2ecf20Sopenharmony_cistruct ncsi_rsp_gns_pkt {
2958c2ecf20Sopenharmony_ci	struct ncsi_rsp_pkt_hdr rsp;           /* Response header         */
2968c2ecf20Sopenharmony_ci	__be32                  rx_cmds;       /* Rx NCSI commands        */
2978c2ecf20Sopenharmony_ci	__be32                  dropped_cmds;  /* Dropped commands        */
2988c2ecf20Sopenharmony_ci	__be32                  cmd_type_errs; /* Command type errors     */
2998c2ecf20Sopenharmony_ci	__be32                  cmd_csum_errs; /* Command checksum errors */
3008c2ecf20Sopenharmony_ci	__be32                  rx_pkts;       /* Rx NCSI packets         */
3018c2ecf20Sopenharmony_ci	__be32                  tx_pkts;       /* Tx NCSI packets         */
3028c2ecf20Sopenharmony_ci	__be32                  tx_aen_pkts;   /* Tx AEN packets          */
3038c2ecf20Sopenharmony_ci	__be32                  checksum;      /* Checksum                */
3048c2ecf20Sopenharmony_ci};
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci/* Get NCSI Pass-through Statistics */
3078c2ecf20Sopenharmony_cistruct ncsi_rsp_gnpts_pkt {
3088c2ecf20Sopenharmony_ci	struct ncsi_rsp_pkt_hdr rsp;            /* Response header     */
3098c2ecf20Sopenharmony_ci	__be32                  tx_pkts;        /* Tx packets          */
3108c2ecf20Sopenharmony_ci	__be32                  tx_dropped;     /* Tx dropped packets  */
3118c2ecf20Sopenharmony_ci	__be32                  tx_channel_err; /* Tx channel errors   */
3128c2ecf20Sopenharmony_ci	__be32                  tx_us_err;      /* Tx undersize errors */
3138c2ecf20Sopenharmony_ci	__be32                  rx_pkts;        /* Rx packets          */
3148c2ecf20Sopenharmony_ci	__be32                  rx_dropped;     /* Rx dropped packets  */
3158c2ecf20Sopenharmony_ci	__be32                  rx_channel_err; /* Rx channel errors   */
3168c2ecf20Sopenharmony_ci	__be32                  rx_us_err;      /* Rx undersize errors */
3178c2ecf20Sopenharmony_ci	__be32                  rx_os_err;      /* Rx oversize errors  */
3188c2ecf20Sopenharmony_ci	__be32                  checksum;       /* Checksum            */
3198c2ecf20Sopenharmony_ci};
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci/* Get package status */
3228c2ecf20Sopenharmony_cistruct ncsi_rsp_gps_pkt {
3238c2ecf20Sopenharmony_ci	struct ncsi_rsp_pkt_hdr rsp;      /* Response header             */
3248c2ecf20Sopenharmony_ci	__be32                  status;   /* Hardware arbitration status */
3258c2ecf20Sopenharmony_ci	__be32                  checksum;
3268c2ecf20Sopenharmony_ci};
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci/* Get package UUID */
3298c2ecf20Sopenharmony_cistruct ncsi_rsp_gpuuid_pkt {
3308c2ecf20Sopenharmony_ci	struct ncsi_rsp_pkt_hdr rsp;      /* Response header */
3318c2ecf20Sopenharmony_ci	unsigned char           uuid[16]; /* UUID            */
3328c2ecf20Sopenharmony_ci	__be32                  checksum;
3338c2ecf20Sopenharmony_ci};
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci/* AEN: Link State Change */
3368c2ecf20Sopenharmony_cistruct ncsi_aen_lsc_pkt {
3378c2ecf20Sopenharmony_ci	struct ncsi_aen_pkt_hdr aen;        /* AEN header      */
3388c2ecf20Sopenharmony_ci	__be32                  status;     /* Link status     */
3398c2ecf20Sopenharmony_ci	__be32                  oem_status; /* OEM link status */
3408c2ecf20Sopenharmony_ci	__be32                  checksum;   /* Checksum        */
3418c2ecf20Sopenharmony_ci	unsigned char           pad[14];
3428c2ecf20Sopenharmony_ci};
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci/* AEN: Configuration Required */
3458c2ecf20Sopenharmony_cistruct ncsi_aen_cr_pkt {
3468c2ecf20Sopenharmony_ci	struct ncsi_aen_pkt_hdr aen;      /* AEN header */
3478c2ecf20Sopenharmony_ci	__be32                  checksum; /* Checksum   */
3488c2ecf20Sopenharmony_ci	unsigned char           pad[22];
3498c2ecf20Sopenharmony_ci};
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ci/* AEN: Host Network Controller Driver Status Change */
3528c2ecf20Sopenharmony_cistruct ncsi_aen_hncdsc_pkt {
3538c2ecf20Sopenharmony_ci	struct ncsi_aen_pkt_hdr aen;      /* AEN header */
3548c2ecf20Sopenharmony_ci	__be32                  status;   /* Status     */
3558c2ecf20Sopenharmony_ci	__be32                  checksum; /* Checksum   */
3568c2ecf20Sopenharmony_ci	unsigned char           pad[18];
3578c2ecf20Sopenharmony_ci};
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci/* NCSI packet revision */
3608c2ecf20Sopenharmony_ci#define NCSI_PKT_REVISION	0x01
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ci/* NCSI packet commands */
3638c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_CIS	0x00 /* Clear Initial State              */
3648c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_SP		0x01 /* Select Package                   */
3658c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_DP		0x02 /* Deselect Package                 */
3668c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_EC		0x03 /* Enable Channel                   */
3678c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_DC		0x04 /* Disable Channel                  */
3688c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_RC		0x05 /* Reset Channel                    */
3698c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_ECNT	0x06 /* Enable Channel Network Tx        */
3708c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_DCNT	0x07 /* Disable Channel Network Tx       */
3718c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_AE		0x08 /* AEN Enable                       */
3728c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_SL		0x09 /* Set Link                         */
3738c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_GLS	0x0a /* Get Link                         */
3748c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_SVF	0x0b /* Set VLAN Filter                  */
3758c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_EV		0x0c /* Enable VLAN                      */
3768c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_DV		0x0d /* Disable VLAN                     */
3778c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_SMA	0x0e /* Set MAC address                  */
3788c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_EBF	0x10 /* Enable Broadcast Filter          */
3798c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_DBF	0x11 /* Disable Broadcast Filter         */
3808c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_EGMF	0x12 /* Enable Global Multicast Filter   */
3818c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_DGMF	0x13 /* Disable Global Multicast Filter  */
3828c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_SNFC	0x14 /* Set NCSI Flow Control            */
3838c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_GVI	0x15 /* Get Version ID                   */
3848c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_GC		0x16 /* Get Capabilities                 */
3858c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_GP		0x17 /* Get Parameters                   */
3868c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_GCPS	0x18 /* Get Controller Packet Statistics */
3878c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_GNS	0x19 /* Get NCSI Statistics              */
3888c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_GNPTS	0x1a /* Get NCSI Pass-throu Statistics   */
3898c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_GPS	0x1b /* Get package status               */
3908c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_OEM	0x50 /* OEM                              */
3918c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_PLDM	0x51 /* PLDM request over NCSI over RBT  */
3928c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_GPUUID	0x52 /* Get package UUID                 */
3938c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_QPNPR	0x56 /* Query Pending NC PLDM request */
3948c2ecf20Sopenharmony_ci#define NCSI_PKT_CMD_SNPR	0x57 /* Send NC PLDM Reply  */
3958c2ecf20Sopenharmony_ci
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci/* NCSI packet responses */
3988c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_CIS	(NCSI_PKT_CMD_CIS    + 0x80)
3998c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_SP		(NCSI_PKT_CMD_SP     + 0x80)
4008c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_DP		(NCSI_PKT_CMD_DP     + 0x80)
4018c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_EC		(NCSI_PKT_CMD_EC     + 0x80)
4028c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_DC		(NCSI_PKT_CMD_DC     + 0x80)
4038c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_RC		(NCSI_PKT_CMD_RC     + 0x80)
4048c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_ECNT	(NCSI_PKT_CMD_ECNT   + 0x80)
4058c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_DCNT	(NCSI_PKT_CMD_DCNT   + 0x80)
4068c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_AE		(NCSI_PKT_CMD_AE     + 0x80)
4078c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_SL		(NCSI_PKT_CMD_SL     + 0x80)
4088c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_GLS	(NCSI_PKT_CMD_GLS    + 0x80)
4098c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_SVF	(NCSI_PKT_CMD_SVF    + 0x80)
4108c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_EV		(NCSI_PKT_CMD_EV     + 0x80)
4118c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_DV		(NCSI_PKT_CMD_DV     + 0x80)
4128c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_SMA	(NCSI_PKT_CMD_SMA    + 0x80)
4138c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_EBF	(NCSI_PKT_CMD_EBF    + 0x80)
4148c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_DBF	(NCSI_PKT_CMD_DBF    + 0x80)
4158c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_EGMF	(NCSI_PKT_CMD_EGMF   + 0x80)
4168c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_DGMF	(NCSI_PKT_CMD_DGMF   + 0x80)
4178c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_SNFC	(NCSI_PKT_CMD_SNFC   + 0x80)
4188c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_GVI	(NCSI_PKT_CMD_GVI    + 0x80)
4198c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_GC		(NCSI_PKT_CMD_GC     + 0x80)
4208c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_GP		(NCSI_PKT_CMD_GP     + 0x80)
4218c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_GCPS	(NCSI_PKT_CMD_GCPS   + 0x80)
4228c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_GNS	(NCSI_PKT_CMD_GNS    + 0x80)
4238c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_GNPTS	(NCSI_PKT_CMD_GNPTS  + 0x80)
4248c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_GPS	(NCSI_PKT_CMD_GPS    + 0x80)
4258c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_OEM	(NCSI_PKT_CMD_OEM    + 0x80)
4268c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_PLDM	(NCSI_PKT_CMD_PLDM   + 0x80)
4278c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_GPUUID	(NCSI_PKT_CMD_GPUUID + 0x80)
4288c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_QPNPR	(NCSI_PKT_CMD_QPNPR   + 0x80)
4298c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_SNPR	(NCSI_PKT_CMD_SNPR   + 0x80)
4308c2ecf20Sopenharmony_ci
4318c2ecf20Sopenharmony_ci/* NCSI response code/reason */
4328c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_C_COMPLETED	0x0000 /* Command Completed        */
4338c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_C_FAILED		0x0001 /* Command Failed           */
4348c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_C_UNAVAILABLE	0x0002 /* Command Unavailable      */
4358c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_C_UNSUPPORTED	0x0003 /* Command Unsupported      */
4368c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_R_NO_ERROR		0x0000 /* No Error                 */
4378c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_R_INTERFACE	0x0001 /* Interface not ready      */
4388c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_R_PARAM		0x0002 /* Invalid Parameter        */
4398c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_R_CHANNEL		0x0003 /* Channel not Ready        */
4408c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_R_PACKAGE		0x0004 /* Package not Ready        */
4418c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_R_LENGTH		0x0005 /* Invalid payload length   */
4428c2ecf20Sopenharmony_ci#define NCSI_PKT_RSP_R_UNKNOWN		0x7fff /* Command type unsupported */
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci/* NCSI AEN packet type */
4458c2ecf20Sopenharmony_ci#define NCSI_PKT_AEN		0xFF /* AEN Packet               */
4468c2ecf20Sopenharmony_ci#define NCSI_PKT_AEN_LSC	0x00 /* Link status change       */
4478c2ecf20Sopenharmony_ci#define NCSI_PKT_AEN_CR		0x01 /* Configuration required   */
4488c2ecf20Sopenharmony_ci#define NCSI_PKT_AEN_HNCDSC	0x02 /* HNC driver status change */
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_ci#endif /* __NCSI_PKT_H__ */
451