Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright Gavin Shan, IBM Corporation 2016.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #ifndef __NCSI_INTERNAL_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #define __NCSI_INTERNAL_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 	NCSI_CAP_BASE		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 	NCSI_CAP_GENERIC	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 	NCSI_CAP_BC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 	NCSI_CAP_MC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 	NCSI_CAP_BUFFER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	NCSI_CAP_AEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	NCSI_CAP_VLAN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	NCSI_CAP_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	NCSI_CAP_GENERIC_HWA             = 0x01, /* HW arbitration           */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	NCSI_CAP_GENERIC_HDS             = 0x02, /* HNC driver status change */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	NCSI_CAP_GENERIC_FC              = 0x04, /* HNC to MC flow control   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	NCSI_CAP_GENERIC_FC1             = 0x08, /* MC to HNC flow control   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	NCSI_CAP_GENERIC_MC              = 0x10, /* Global MC filtering      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	NCSI_CAP_GENERIC_HWA_UNKNOWN     = 0x00, /* Unknown HW arbitration   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	NCSI_CAP_GENERIC_HWA_SUPPORT     = 0x20, /* Supported HW arbitration */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	NCSI_CAP_GENERIC_HWA_NOT_SUPPORT = 0x40, /* No HW arbitration        */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	NCSI_CAP_GENERIC_HWA_RESERVED    = 0x60, /* Reserved HW arbitration  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	NCSI_CAP_GENERIC_HWA_MASK        = 0x60, /* Mask for HW arbitration  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	NCSI_CAP_GENERIC_MASK            = 0x7f,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	NCSI_CAP_BC_ARP                  = 0x01, /* ARP packet filtering     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	NCSI_CAP_BC_DHCPC                = 0x02, /* DHCP client filtering    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	NCSI_CAP_BC_DHCPS                = 0x04, /* DHCP server filtering    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	NCSI_CAP_BC_NETBIOS              = 0x08, /* NetBIOS packet filtering */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	NCSI_CAP_BC_MASK                 = 0x0f,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	NCSI_CAP_MC_IPV6_NEIGHBOR        = 0x01, /* IPv6 neighbor filtering  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	NCSI_CAP_MC_IPV6_ROUTER          = 0x02, /* IPv6 router filering     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	NCSI_CAP_MC_DHCPV6_RELAY         = 0x04, /* DHCPv6 relay / server MC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	NCSI_CAP_MC_DHCPV6_WELL_KNOWN    = 0x08, /* DHCPv6 well-known MC     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	NCSI_CAP_MC_IPV6_MLD             = 0x10, /* IPv6 MLD filtering       */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	NCSI_CAP_MC_IPV6_NEIGHBOR_S      = 0x20, /* IPv6 neighbour filtering */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	NCSI_CAP_MC_MASK                 = 0x3f,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	NCSI_CAP_AEN_LSC                 = 0x01, /* Link status change       */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	NCSI_CAP_AEN_CR                  = 0x02, /* Configuration required   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	NCSI_CAP_AEN_HDS                 = 0x04, /* HNC driver status        */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	NCSI_CAP_AEN_MASK                = 0x07,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	NCSI_CAP_VLAN_ONLY               = 0x01, /* Filter VLAN packet only  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	NCSI_CAP_VLAN_NO                 = 0x02, /* Filter VLAN and non-VLAN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	NCSI_CAP_VLAN_ANY                = 0x04, /* Filter Any-and-non-VLAN  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	NCSI_CAP_VLAN_MASK               = 0x07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	NCSI_MODE_BASE		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	NCSI_MODE_ENABLE	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	NCSI_MODE_TX_ENABLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	NCSI_MODE_LINK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	NCSI_MODE_VLAN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	NCSI_MODE_BC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	NCSI_MODE_MC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	NCSI_MODE_AEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	NCSI_MODE_FC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	NCSI_MODE_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) /* Supported media status bits for Mellanox Mac affinity command.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  * Bit (0-2) for different protocol support; Bit 1 for RBT support,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  * bit 1 for SMBUS support and bit 2 for PCIE support. Bit (3-5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  * for different protocol availability. Bit 4 for RBT, bit 4 for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  * SMBUS and bit 5 for PCIE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	MLX_MC_RBT_SUPPORT  = 0x01, /* MC supports RBT         */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	MLX_MC_RBT_AVL      = 0x08, /* RBT medium is available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) /* OEM Vendor Manufacture ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #define NCSI_OEM_MFR_MLX_ID             0x8119
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) #define NCSI_OEM_MFR_BCM_ID             0x113d
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) /* Broadcom specific OEM Command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) #define NCSI_OEM_BCM_CMD_GMA            0x01   /* CMD ID for Get MAC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) /* Mellanox specific OEM Command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) #define NCSI_OEM_MLX_CMD_GMA            0x00   /* CMD ID for Get MAC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) #define NCSI_OEM_MLX_CMD_GMA_PARAM      0x1b   /* Parameter for GMA  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #define NCSI_OEM_MLX_CMD_SMAF           0x01   /* CMD ID for Set MC Affinity */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) #define NCSI_OEM_MLX_CMD_SMAF_PARAM     0x07   /* Parameter for SMAF         */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) /* OEM Command payload lengths*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) #define NCSI_OEM_BCM_CMD_GMA_LEN        12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) #define NCSI_OEM_MLX_CMD_GMA_LEN        8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) #define NCSI_OEM_MLX_CMD_SMAF_LEN        60
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) /* Offset in OEM request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) #define MLX_SMAF_MAC_ADDR_OFFSET         8     /* Offset for MAC in SMAF    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) #define MLX_SMAF_MED_SUPPORT_OFFSET      14    /* Offset for medium in SMAF */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) /* Mac address offset in OEM response */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) #define BCM_MAC_ADDR_OFFSET             28
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #define MLX_MAC_ADDR_OFFSET             8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) struct ncsi_channel_version {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	u32 version;		/* Supported BCD encoded NCSI version */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	u32 alpha2;		/* Supported BCD encoded NCSI version */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	u8  fw_name[12];	/* Firware name string                */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	u32 fw_version;		/* Firmware version                   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	u16 pci_ids[4];		/* PCI identification                 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	u32 mf_id;		/* Manufacture ID                     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) struct ncsi_channel_cap {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	u32 index;	/* Index of channel capabilities */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	u32 cap;	/* NCSI channel capability       */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) struct ncsi_channel_mode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	u32 index;	/* Index of channel modes      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	u32 enable;	/* Enabled or disabled         */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	u32 size;	/* Valid entries in ncm_data[] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	u32 data[8];	/* Data entries                */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) struct ncsi_channel_mac_filter {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	u8	n_uc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	u8	n_mc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	u8	n_mixed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	u64	bitmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	unsigned char	*addrs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) struct ncsi_channel_vlan_filter {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	u8	n_vids;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	u64	bitmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	u16	*vids;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) struct ncsi_channel_stats {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	u32 hnc_cnt_hi;		/* Counter cleared            */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	u32 hnc_cnt_lo;		/* Counter cleared            */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	u32 hnc_rx_bytes;	/* Rx bytes                   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	u32 hnc_tx_bytes;	/* Tx bytes                   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	u32 hnc_rx_uc_pkts;	/* Rx UC packets              */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	u32 hnc_rx_mc_pkts;     /* Rx MC packets              */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	u32 hnc_rx_bc_pkts;	/* Rx BC packets              */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	u32 hnc_tx_uc_pkts;	/* Tx UC packets              */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	u32 hnc_tx_mc_pkts;	/* Tx MC packets              */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	u32 hnc_tx_bc_pkts;	/* Tx BC packets              */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	u32 hnc_fcs_err;	/* FCS errors                 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	u32 hnc_align_err;	/* Alignment errors           */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	u32 hnc_false_carrier;	/* False carrier detection    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	u32 hnc_runt_pkts;	/* Rx runt packets            */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	u32 hnc_jabber_pkts;	/* Rx jabber packets          */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	u32 hnc_rx_pause_xon;	/* Rx pause XON frames        */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	u32 hnc_rx_pause_xoff;	/* Rx XOFF frames             */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	u32 hnc_tx_pause_xon;	/* Tx XON frames              */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	u32 hnc_tx_pause_xoff;	/* Tx XOFF frames             */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	u32 hnc_tx_s_collision;	/* Single collision frames    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	u32 hnc_tx_m_collision;	/* Multiple collision frames  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	u32 hnc_l_collision;	/* Late collision frames      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	u32 hnc_e_collision;	/* Excessive collision frames */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	u32 hnc_rx_ctl_frames;	/* Rx control frames          */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	u32 hnc_rx_64_frames;	/* Rx 64-bytes frames         */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	u32 hnc_rx_127_frames;	/* Rx 65-127 bytes frames     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	u32 hnc_rx_255_frames;	/* Rx 128-255 bytes frames    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	u32 hnc_rx_511_frames;	/* Rx 256-511 bytes frames    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	u32 hnc_rx_1023_frames;	/* Rx 512-1023 bytes frames   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	u32 hnc_rx_1522_frames;	/* Rx 1024-1522 bytes frames  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	u32 hnc_rx_9022_frames;	/* Rx 1523-9022 bytes frames  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	u32 hnc_tx_64_frames;	/* Tx 64-bytes frames         */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	u32 hnc_tx_127_frames;	/* Tx 65-127 bytes frames     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	u32 hnc_tx_255_frames;	/* Tx 128-255 bytes frames    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	u32 hnc_tx_511_frames;	/* Tx 256-511 bytes frames    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	u32 hnc_tx_1023_frames;	/* Tx 512-1023 bytes frames   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	u32 hnc_tx_1522_frames;	/* Tx 1024-1522 bytes frames  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	u32 hnc_tx_9022_frames;	/* Tx 1523-9022 bytes frames  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	u32 hnc_rx_valid_bytes;	/* Rx valid bytes             */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	u32 hnc_rx_runt_pkts;	/* Rx error runt packets      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	u32 hnc_rx_jabber_pkts;	/* Rx error jabber packets    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	u32 ncsi_rx_cmds;	/* Rx NCSI commands           */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	u32 ncsi_dropped_cmds;	/* Dropped commands           */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	u32 ncsi_cmd_type_errs;	/* Command type errors        */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	u32 ncsi_cmd_csum_errs;	/* Command checksum errors    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	u32 ncsi_rx_pkts;	/* Rx NCSI packets            */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	u32 ncsi_tx_pkts;	/* Tx NCSI packets            */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	u32 ncsi_tx_aen_pkts;	/* Tx AEN packets             */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	u32 pt_tx_pkts;		/* Tx packets                 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	u32 pt_tx_dropped;	/* Tx dropped packets         */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	u32 pt_tx_channel_err;	/* Tx channel errors          */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	u32 pt_tx_us_err;	/* Tx undersize errors        */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	u32 pt_rx_pkts;		/* Rx packets                 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	u32 pt_rx_dropped;	/* Rx dropped packets         */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	u32 pt_rx_channel_err;	/* Rx channel errors          */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	u32 pt_rx_us_err;	/* Rx undersize errors        */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	u32 pt_rx_os_err;	/* Rx oversize errors         */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) struct ncsi_dev_priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) struct ncsi_package;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) #define NCSI_PACKAGE_SHIFT	5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) #define NCSI_PACKAGE_INDEX(c)	(((c) >> NCSI_PACKAGE_SHIFT) & 0x7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) #define NCSI_RESERVED_CHANNEL	0x1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) #define NCSI_CHANNEL_INDEX(c)	((c) & ((1 << NCSI_PACKAGE_SHIFT) - 1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #define NCSI_TO_CHANNEL(p, c)	(((p) << NCSI_PACKAGE_SHIFT) | (c))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) #define NCSI_MAX_PACKAGE	8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) #define NCSI_MAX_CHANNEL	32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) struct ncsi_channel {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	unsigned char               id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	int                         state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) #define NCSI_CHANNEL_INACTIVE		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) #define NCSI_CHANNEL_ACTIVE		2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) #define NCSI_CHANNEL_INVISIBLE		3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	bool                        reconfigure_needed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	spinlock_t                  lock;	/* Protect filters etc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	struct ncsi_package         *package;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	struct ncsi_channel_version version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	struct ncsi_channel_cap	    caps[NCSI_CAP_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	struct ncsi_channel_mode    modes[NCSI_MODE_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	/* Filtering Settings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	struct ncsi_channel_mac_filter	mac_filter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	struct ncsi_channel_vlan_filter	vlan_filter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	struct ncsi_channel_stats   stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		struct timer_list   timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		bool                enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 		unsigned int        state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) #define NCSI_CHANNEL_MONITOR_START	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) #define NCSI_CHANNEL_MONITOR_RETRY	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) #define NCSI_CHANNEL_MONITOR_WAIT	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) #define NCSI_CHANNEL_MONITOR_WAIT_MAX	5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	} monitor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	struct list_head            node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	struct list_head            link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) struct ncsi_package {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	unsigned char        id;          /* NCSI 3-bits package ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	unsigned char        uuid[16];    /* UUID                   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	struct ncsi_dev_priv *ndp;        /* NCSI device            */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	spinlock_t           lock;        /* Protect the package    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	unsigned int         channel_num; /* Number of channels     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	struct list_head     channels;    /* List of chanels        */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	struct list_head     node;        /* Form list of packages  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	bool                 multi_channel; /* Enable multiple channels  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	u32                  channel_whitelist; /* Channels to configure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	struct ncsi_channel  *preferred_channel; /* Primary channel      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) struct ncsi_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	unsigned char        id;      /* Request ID - 0 to 255           */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	bool                 used;    /* Request that has been assigned  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	unsigned int         flags;   /* NCSI request property           */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) #define NCSI_REQ_FLAG_EVENT_DRIVEN	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) #define NCSI_REQ_FLAG_NETLINK_DRIVEN	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	struct ncsi_dev_priv *ndp;    /* Associated NCSI device          */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	struct sk_buff       *cmd;    /* Associated NCSI command packet  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	struct sk_buff       *rsp;    /* Associated NCSI response packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	struct timer_list    timer;   /* Timer on waiting for response   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	bool                 enabled; /* Time has been enabled or not    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	u32                  snd_seq;     /* netlink sending sequence number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	u32                  snd_portid;  /* netlink portid of sender        */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	struct nlmsghdr      nlhdr;       /* netlink message header          */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	ncsi_dev_state_major		= 0xff00,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	ncsi_dev_state_minor		= 0x00ff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	ncsi_dev_state_probe_deselect	= 0x0201,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	ncsi_dev_state_probe_package,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	ncsi_dev_state_probe_channel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	ncsi_dev_state_probe_mlx_gma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	ncsi_dev_state_probe_mlx_smaf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	ncsi_dev_state_probe_cis,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	ncsi_dev_state_probe_gvi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	ncsi_dev_state_probe_gc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	ncsi_dev_state_probe_gls,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	ncsi_dev_state_probe_dp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	ncsi_dev_state_config_sp	= 0x0301,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	ncsi_dev_state_config_cis,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	ncsi_dev_state_config_oem_gma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	ncsi_dev_state_config_clear_vids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	ncsi_dev_state_config_svf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	ncsi_dev_state_config_ev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	ncsi_dev_state_config_sma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	ncsi_dev_state_config_ebf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	ncsi_dev_state_config_dgmf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	ncsi_dev_state_config_ecnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	ncsi_dev_state_config_ec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	ncsi_dev_state_config_ae,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	ncsi_dev_state_config_gls,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	ncsi_dev_state_config_done,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	ncsi_dev_state_suspend_select	= 0x0401,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	ncsi_dev_state_suspend_gls,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	ncsi_dev_state_suspend_dcnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	ncsi_dev_state_suspend_dc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	ncsi_dev_state_suspend_deselect,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	ncsi_dev_state_suspend_done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) struct vlan_vid {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	__be16 proto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	u16 vid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) struct ncsi_dev_priv {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	struct ncsi_dev     ndev;            /* Associated NCSI device     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 	unsigned int        flags;           /* NCSI device flags          */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) #define NCSI_DEV_PROBED		1            /* Finalized NCSI topology    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) #define NCSI_DEV_HWA		2            /* Enabled HW arbitration     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) #define NCSI_DEV_RESHUFFLE	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) #define NCSI_DEV_RESET		8            /* Reset state of NC          */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	unsigned int        gma_flag;        /* OEM GMA flag               */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	spinlock_t          lock;            /* Protect the NCSI device    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	unsigned int        package_probe_id;/* Current ID during probe    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	unsigned int        package_num;     /* Number of packages         */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	struct list_head    packages;        /* List of packages           */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 	struct ncsi_channel *hot_channel;    /* Channel was ever active    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	struct ncsi_request requests[256];   /* Request table              */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	unsigned int        request_id;      /* Last used request ID       */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) #define NCSI_REQ_START_IDX	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	unsigned int        pending_req_num; /* Number of pending requests */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 	struct ncsi_package *active_package; /* Currently handled package  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	struct ncsi_channel *active_channel; /* Currently handled channel  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	struct list_head    channel_queue;   /* Config queue of channels   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	struct work_struct  work;            /* For channel management     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	struct packet_type  ptype;           /* NCSI packet Rx handler     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	struct list_head    node;            /* Form NCSI device list      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) #define NCSI_MAX_VLAN_VIDS	15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	struct list_head    vlan_vids;       /* List of active VLAN IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	bool                multi_package;   /* Enable multiple packages   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	bool                mlx_multi_host;  /* Enable multi host Mellanox */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	u32                 package_whitelist; /* Packages to configure    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) struct ncsi_cmd_arg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	struct ncsi_dev_priv *ndp;        /* Associated NCSI device        */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	unsigned char        type;        /* Command in the NCSI packet    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	unsigned char        id;          /* Request ID (sequence number)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	unsigned char        package;     /* Destination package ID        */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	unsigned char        channel;     /* Detination channel ID or 0x1f */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	unsigned short       payload;     /* Command packet payload length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 	unsigned int         req_flags;   /* NCSI request properties       */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 		unsigned char  bytes[16]; /* Command packet specific data  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 		unsigned short words[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 		unsigned int   dwords[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 	unsigned char        *data;       /* NCSI OEM data                 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	struct genl_info     *info;       /* Netlink information           */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) extern struct list_head ncsi_dev_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) extern spinlock_t ncsi_dev_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) #define TO_NCSI_DEV_PRIV(nd) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	container_of(nd, struct ncsi_dev_priv, ndev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) #define NCSI_FOR_EACH_DEV(ndp) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	list_for_each_entry_rcu(ndp, &ncsi_dev_list, node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) #define NCSI_FOR_EACH_PACKAGE(ndp, np) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	list_for_each_entry_rcu(np, &ndp->packages, node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) #define NCSI_FOR_EACH_CHANNEL(np, nc) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 	list_for_each_entry_rcu(nc, &np->channels, node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) /* Resources */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) int ncsi_reset_dev(struct ncsi_dev *nd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) void ncsi_start_channel_monitor(struct ncsi_channel *nc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) void ncsi_stop_channel_monitor(struct ncsi_channel *nc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) struct ncsi_channel *ncsi_find_channel(struct ncsi_package *np,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 				       unsigned char id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) struct ncsi_channel *ncsi_add_channel(struct ncsi_package *np,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 				      unsigned char id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) struct ncsi_package *ncsi_find_package(struct ncsi_dev_priv *ndp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 				       unsigned char id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) struct ncsi_package *ncsi_add_package(struct ncsi_dev_priv *ndp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 				      unsigned char id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) void ncsi_remove_package(struct ncsi_package *np);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) void ncsi_find_package_and_channel(struct ncsi_dev_priv *ndp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 				   unsigned char id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 				   struct ncsi_package **np,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 				   struct ncsi_channel **nc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) struct ncsi_request *ncsi_alloc_request(struct ncsi_dev_priv *ndp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 					unsigned int req_flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) void ncsi_free_request(struct ncsi_request *nr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) struct ncsi_dev *ncsi_find_dev(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) int ncsi_process_next_channel(struct ncsi_dev_priv *ndp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) bool ncsi_channel_has_link(struct ncsi_channel *channel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) bool ncsi_channel_is_last(struct ncsi_dev_priv *ndp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 			  struct ncsi_channel *channel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) int ncsi_update_tx_channel(struct ncsi_dev_priv *ndp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 			   struct ncsi_package *np,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 			   struct ncsi_channel *disable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 			   struct ncsi_channel *enable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) /* Packet handlers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) u32 ncsi_calculate_checksum(unsigned char *data, int len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) int ncsi_rcv_rsp(struct sk_buff *skb, struct net_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 		 struct packet_type *pt, struct net_device *orig_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) int ncsi_aen_handler(struct ncsi_dev_priv *ndp, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) #endif /* __NCSI_INTERNAL_H__ */