blob: 87505600dbb2d298a9af6b32c83d9fb24ea019bb [file] [log] [blame]
Gavin Shan2d283bd2016-07-19 11:54:16 +10001/*
2 * Copyright Gavin Shan, IBM Corporation 2016.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10#ifndef __NCSI_INTERNAL_H__
11#define __NCSI_INTERNAL_H__
12
13enum {
14 NCSI_CAP_BASE = 0,
15 NCSI_CAP_GENERIC = 0,
16 NCSI_CAP_BC,
17 NCSI_CAP_MC,
18 NCSI_CAP_BUFFER,
19 NCSI_CAP_AEN,
20 NCSI_CAP_VLAN,
21 NCSI_CAP_MAX
22};
23
24enum {
25 NCSI_CAP_GENERIC_HWA = 0x01, /* HW arbitration */
26 NCSI_CAP_GENERIC_HDS = 0x02, /* HNC driver status change */
27 NCSI_CAP_GENERIC_FC = 0x04, /* HNC to MC flow control */
28 NCSI_CAP_GENERIC_FC1 = 0x08, /* MC to HNC flow control */
29 NCSI_CAP_GENERIC_MC = 0x10, /* Global MC filtering */
30 NCSI_CAP_GENERIC_HWA_UNKNOWN = 0x00, /* Unknown HW arbitration */
31 NCSI_CAP_GENERIC_HWA_SUPPORT = 0x20, /* Supported HW arbitration */
32 NCSI_CAP_GENERIC_HWA_NOT_SUPPORT = 0x40, /* No HW arbitration */
33 NCSI_CAP_GENERIC_HWA_RESERVED = 0x60, /* Reserved HW arbitration */
34 NCSI_CAP_GENERIC_HWA_MASK = 0x60, /* Mask for HW arbitration */
35 NCSI_CAP_GENERIC_MASK = 0x7f,
36 NCSI_CAP_BC_ARP = 0x01, /* ARP packet filtering */
37 NCSI_CAP_BC_DHCPC = 0x02, /* DHCP client filtering */
38 NCSI_CAP_BC_DHCPS = 0x04, /* DHCP server filtering */
39 NCSI_CAP_BC_NETBIOS = 0x08, /* NetBIOS packet filtering */
40 NCSI_CAP_BC_MASK = 0x0f,
41 NCSI_CAP_MC_IPV6_NEIGHBOR = 0x01, /* IPv6 neighbor filtering */
42 NCSI_CAP_MC_IPV6_ROUTER = 0x02, /* IPv6 router filering */
43 NCSI_CAP_MC_DHCPV6_RELAY = 0x04, /* DHCPv6 relay / server MC */
44 NCSI_CAP_MC_DHCPV6_WELL_KNOWN = 0x08, /* DHCPv6 well-known MC */
45 NCSI_CAP_MC_IPV6_MLD = 0x10, /* IPv6 MLD filtering */
46 NCSI_CAP_MC_IPV6_NEIGHBOR_S = 0x20, /* IPv6 neighbour filtering */
47 NCSI_CAP_MC_MASK = 0x3f,
48 NCSI_CAP_AEN_LSC = 0x01, /* Link status change */
49 NCSI_CAP_AEN_CR = 0x02, /* Configuration required */
50 NCSI_CAP_AEN_HDS = 0x04, /* HNC driver status */
51 NCSI_CAP_AEN_MASK = 0x07,
52 NCSI_CAP_VLAN_ONLY = 0x01, /* Filter VLAN packet only */
53 NCSI_CAP_VLAN_NO = 0x02, /* Filter VLAN and non-VLAN */
54 NCSI_CAP_VLAN_ANY = 0x04, /* Filter Any-and-non-VLAN */
55 NCSI_CAP_VLAN_MASK = 0x07
56};
57
58enum {
59 NCSI_MODE_BASE = 0,
60 NCSI_MODE_ENABLE = 0,
61 NCSI_MODE_TX_ENABLE,
62 NCSI_MODE_LINK,
63 NCSI_MODE_VLAN,
64 NCSI_MODE_BC,
65 NCSI_MODE_MC,
66 NCSI_MODE_AEN,
67 NCSI_MODE_FC,
68 NCSI_MODE_MAX
69};
70
Vijay Khemkafb4ee672018-10-05 10:46:01 -070071/* OEM Vendor Manufacture ID */
72#define NCSI_OEM_MFR_MLX_ID 0x8119
73#define NCSI_OEM_MFR_BCM_ID 0x113d
Vijay Khemkacb10c7c2018-10-16 12:13:19 -070074/* Broadcom specific OEM Command */
75#define NCSI_OEM_BCM_CMD_GMA 0x01 /* CMD ID for Get MAC */
Vijay Khemka16e8c4c2018-11-26 13:49:04 -080076/* Mellanox specific OEM Command */
77#define NCSI_OEM_MLX_CMD_GMA 0x00 /* CMD ID for Get MAC */
78#define NCSI_OEM_MLX_CMD_GMA_PARAM 0x1b /* Parameter for GMA */
Vijay Khemkacb10c7c2018-10-16 12:13:19 -070079/* OEM Command payload lengths*/
80#define NCSI_OEM_BCM_CMD_GMA_LEN 12
Vijay Khemka16e8c4c2018-11-26 13:49:04 -080081#define NCSI_OEM_MLX_CMD_GMA_LEN 8
Vijay Khemkacb10c7c2018-10-16 12:13:19 -070082/* Mac address offset in OEM response */
83#define BCM_MAC_ADDR_OFFSET 28
Vijay Khemka16e8c4c2018-11-26 13:49:04 -080084#define MLX_MAC_ADDR_OFFSET 8
Vijay Khemkacb10c7c2018-10-16 12:13:19 -070085
Vijay Khemkafb4ee672018-10-05 10:46:01 -070086
Gavin Shan2d283bd2016-07-19 11:54:16 +100087struct ncsi_channel_version {
88 u32 version; /* Supported BCD encoded NCSI version */
89 u32 alpha2; /* Supported BCD encoded NCSI version */
90 u8 fw_name[12]; /* Firware name string */
91 u32 fw_version; /* Firmware version */
92 u16 pci_ids[4]; /* PCI identification */
93 u32 mf_id; /* Manufacture ID */
94};
95
96struct ncsi_channel_cap {
97 u32 index; /* Index of channel capabilities */
98 u32 cap; /* NCSI channel capability */
99};
100
101struct ncsi_channel_mode {
102 u32 index; /* Index of channel modes */
103 u32 enable; /* Enabled or disabled */
104 u32 size; /* Valid entries in ncm_data[] */
105 u32 data[8]; /* Data entries */
106};
107
Samuel Mendoza-Jonas062b3e12018-04-17 14:23:23 +1000108struct ncsi_channel_mac_filter {
109 u8 n_uc;
110 u8 n_mc;
111 u8 n_mixed;
112 u64 bitmap;
113 unsigned char *addrs;
114};
115
116struct ncsi_channel_vlan_filter {
117 u8 n_vids;
118 u64 bitmap;
119 u16 *vids;
Gavin Shan2d283bd2016-07-19 11:54:16 +1000120};
121
122struct ncsi_channel_stats {
123 u32 hnc_cnt_hi; /* Counter cleared */
124 u32 hnc_cnt_lo; /* Counter cleared */
125 u32 hnc_rx_bytes; /* Rx bytes */
126 u32 hnc_tx_bytes; /* Tx bytes */
127 u32 hnc_rx_uc_pkts; /* Rx UC packets */
128 u32 hnc_rx_mc_pkts; /* Rx MC packets */
129 u32 hnc_rx_bc_pkts; /* Rx BC packets */
130 u32 hnc_tx_uc_pkts; /* Tx UC packets */
131 u32 hnc_tx_mc_pkts; /* Tx MC packets */
132 u32 hnc_tx_bc_pkts; /* Tx BC packets */
133 u32 hnc_fcs_err; /* FCS errors */
134 u32 hnc_align_err; /* Alignment errors */
135 u32 hnc_false_carrier; /* False carrier detection */
136 u32 hnc_runt_pkts; /* Rx runt packets */
137 u32 hnc_jabber_pkts; /* Rx jabber packets */
138 u32 hnc_rx_pause_xon; /* Rx pause XON frames */
139 u32 hnc_rx_pause_xoff; /* Rx XOFF frames */
140 u32 hnc_tx_pause_xon; /* Tx XON frames */
141 u32 hnc_tx_pause_xoff; /* Tx XOFF frames */
142 u32 hnc_tx_s_collision; /* Single collision frames */
143 u32 hnc_tx_m_collision; /* Multiple collision frames */
144 u32 hnc_l_collision; /* Late collision frames */
145 u32 hnc_e_collision; /* Excessive collision frames */
146 u32 hnc_rx_ctl_frames; /* Rx control frames */
147 u32 hnc_rx_64_frames; /* Rx 64-bytes frames */
148 u32 hnc_rx_127_frames; /* Rx 65-127 bytes frames */
149 u32 hnc_rx_255_frames; /* Rx 128-255 bytes frames */
150 u32 hnc_rx_511_frames; /* Rx 256-511 bytes frames */
151 u32 hnc_rx_1023_frames; /* Rx 512-1023 bytes frames */
152 u32 hnc_rx_1522_frames; /* Rx 1024-1522 bytes frames */
153 u32 hnc_rx_9022_frames; /* Rx 1523-9022 bytes frames */
154 u32 hnc_tx_64_frames; /* Tx 64-bytes frames */
155 u32 hnc_tx_127_frames; /* Tx 65-127 bytes frames */
156 u32 hnc_tx_255_frames; /* Tx 128-255 bytes frames */
157 u32 hnc_tx_511_frames; /* Tx 256-511 bytes frames */
158 u32 hnc_tx_1023_frames; /* Tx 512-1023 bytes frames */
159 u32 hnc_tx_1522_frames; /* Tx 1024-1522 bytes frames */
160 u32 hnc_tx_9022_frames; /* Tx 1523-9022 bytes frames */
161 u32 hnc_rx_valid_bytes; /* Rx valid bytes */
162 u32 hnc_rx_runt_pkts; /* Rx error runt packets */
163 u32 hnc_rx_jabber_pkts; /* Rx error jabber packets */
164 u32 ncsi_rx_cmds; /* Rx NCSI commands */
165 u32 ncsi_dropped_cmds; /* Dropped commands */
166 u32 ncsi_cmd_type_errs; /* Command type errors */
167 u32 ncsi_cmd_csum_errs; /* Command checksum errors */
168 u32 ncsi_rx_pkts; /* Rx NCSI packets */
169 u32 ncsi_tx_pkts; /* Tx NCSI packets */
170 u32 ncsi_tx_aen_pkts; /* Tx AEN packets */
171 u32 pt_tx_pkts; /* Tx packets */
172 u32 pt_tx_dropped; /* Tx dropped packets */
173 u32 pt_tx_channel_err; /* Tx channel errors */
174 u32 pt_tx_us_err; /* Tx undersize errors */
175 u32 pt_rx_pkts; /* Rx packets */
176 u32 pt_rx_dropped; /* Rx dropped packets */
177 u32 pt_rx_channel_err; /* Rx channel errors */
178 u32 pt_rx_us_err; /* Rx undersize errors */
179 u32 pt_rx_os_err; /* Rx oversize errors */
180};
181
182struct ncsi_dev_priv;
183struct ncsi_package;
184
185#define NCSI_PACKAGE_SHIFT 5
186#define NCSI_PACKAGE_INDEX(c) (((c) >> NCSI_PACKAGE_SHIFT) & 0x7)
Gavin Shanbc7e0f52016-10-04 11:25:48 +1100187#define NCSI_RESERVED_CHANNEL 0x1f
Gavin Shan2d283bd2016-07-19 11:54:16 +1000188#define NCSI_CHANNEL_INDEX(c) ((c) & ((1 << NCSI_PACKAGE_SHIFT) - 1))
189#define NCSI_TO_CHANNEL(p, c) (((p) << NCSI_PACKAGE_SHIFT) | (c))
Justin.Lee1@Dell.com9771b8c2018-10-11 18:07:37 +0000190#define NCSI_MAX_PACKAGE 8
191#define NCSI_MAX_CHANNEL 32
Gavin Shan2d283bd2016-07-19 11:54:16 +1000192
193struct ncsi_channel {
194 unsigned char id;
195 int state;
196#define NCSI_CHANNEL_INACTIVE 1
197#define NCSI_CHANNEL_ACTIVE 2
Gavin Shane6f44ed2016-07-19 11:54:19 +1000198#define NCSI_CHANNEL_INVISIBLE 3
Samuel Mendoza-Jonas21acf632017-08-28 16:18:42 +1000199 bool reconfigure_needed;
Gavin Shan2d283bd2016-07-19 11:54:16 +1000200 spinlock_t lock; /* Protect filters etc */
201 struct ncsi_package *package;
202 struct ncsi_channel_version version;
203 struct ncsi_channel_cap caps[NCSI_CAP_MAX];
204 struct ncsi_channel_mode modes[NCSI_MODE_MAX];
Samuel Mendoza-Jonas062b3e12018-04-17 14:23:23 +1000205 /* Filtering Settings */
206 struct ncsi_channel_mac_filter mac_filter;
207 struct ncsi_channel_vlan_filter vlan_filter;
Gavin Shan2d283bd2016-07-19 11:54:16 +1000208 struct ncsi_channel_stats stats;
Gavin Shan83afdc62016-10-04 11:25:52 +1100209 struct {
210 struct timer_list timer;
211 bool enabled;
212 unsigned int state;
213#define NCSI_CHANNEL_MONITOR_START 0
214#define NCSI_CHANNEL_MONITOR_RETRY 1
215#define NCSI_CHANNEL_MONITOR_WAIT 2
216#define NCSI_CHANNEL_MONITOR_WAIT_MAX 5
217 } monitor;
Gavin Shan2d283bd2016-07-19 11:54:16 +1000218 struct list_head node;
Gavin Shane6f44ed2016-07-19 11:54:19 +1000219 struct list_head link;
Gavin Shan2d283bd2016-07-19 11:54:16 +1000220};
221
222struct ncsi_package {
223 unsigned char id; /* NCSI 3-bits package ID */
224 unsigned char uuid[16]; /* UUID */
225 struct ncsi_dev_priv *ndp; /* NCSI device */
226 spinlock_t lock; /* Protect the package */
227 unsigned int channel_num; /* Number of channels */
228 struct list_head channels; /* List of chanels */
229 struct list_head node; /* Form list of packages */
Samuel Mendoza-Jonas8d951a72018-11-16 15:51:59 +1100230
231 bool multi_channel; /* Enable multiple channels */
232 u32 channel_whitelist; /* Channels to configure */
233 struct ncsi_channel *preferred_channel; /* Primary channel */
Gavin Shan2d283bd2016-07-19 11:54:16 +1000234};
235
236struct ncsi_request {
237 unsigned char id; /* Request ID - 0 to 255 */
238 bool used; /* Request that has been assigned */
Gavin Shana0509cb2016-10-04 11:25:51 +1100239 unsigned int flags; /* NCSI request property */
240#define NCSI_REQ_FLAG_EVENT_DRIVEN 1
Justin.Lee1@Dell.com9771b8c2018-10-11 18:07:37 +0000241#define NCSI_REQ_FLAG_NETLINK_DRIVEN 2
Gavin Shan2d283bd2016-07-19 11:54:16 +1000242 struct ncsi_dev_priv *ndp; /* Associated NCSI device */
243 struct sk_buff *cmd; /* Associated NCSI command packet */
244 struct sk_buff *rsp; /* Associated NCSI response packet */
245 struct timer_list timer; /* Timer on waiting for response */
246 bool enabled; /* Time has been enabled or not */
Justin.Lee1@Dell.com9771b8c2018-10-11 18:07:37 +0000247 u32 snd_seq; /* netlink sending sequence number */
248 u32 snd_portid; /* netlink portid of sender */
249 struct nlmsghdr nlhdr; /* netlink message header */
Gavin Shan2d283bd2016-07-19 11:54:16 +1000250};
251
Gavin Shane6f44ed2016-07-19 11:54:19 +1000252enum {
253 ncsi_dev_state_major = 0xff00,
254 ncsi_dev_state_minor = 0x00ff,
255 ncsi_dev_state_probe_deselect = 0x0201,
256 ncsi_dev_state_probe_package,
257 ncsi_dev_state_probe_channel,
258 ncsi_dev_state_probe_cis,
259 ncsi_dev_state_probe_gvi,
260 ncsi_dev_state_probe_gc,
261 ncsi_dev_state_probe_gls,
262 ncsi_dev_state_probe_dp,
263 ncsi_dev_state_config_sp = 0x0301,
264 ncsi_dev_state_config_cis,
Vijay Khemkacb10c7c2018-10-16 12:13:19 -0700265 ncsi_dev_state_config_oem_gma,
Samuel Mendoza-Jonas21acf632017-08-28 16:18:42 +1000266 ncsi_dev_state_config_clear_vids,
267 ncsi_dev_state_config_svf,
268 ncsi_dev_state_config_ev,
Gavin Shane6f44ed2016-07-19 11:54:19 +1000269 ncsi_dev_state_config_sma,
270 ncsi_dev_state_config_ebf,
271#if IS_ENABLED(CONFIG_IPV6)
272 ncsi_dev_state_config_egmf,
273#endif
274 ncsi_dev_state_config_ecnt,
275 ncsi_dev_state_config_ec,
276 ncsi_dev_state_config_ae,
277 ncsi_dev_state_config_gls,
278 ncsi_dev_state_config_done,
279 ncsi_dev_state_suspend_select = 0x0401,
Gavin Shan008a4242016-10-20 11:45:50 +1100280 ncsi_dev_state_suspend_gls,
Gavin Shane6f44ed2016-07-19 11:54:19 +1000281 ncsi_dev_state_suspend_dcnt,
282 ncsi_dev_state_suspend_dc,
283 ncsi_dev_state_suspend_deselect,
284 ncsi_dev_state_suspend_done
285};
286
Samuel Mendoza-Jonas21acf632017-08-28 16:18:42 +1000287struct vlan_vid {
288 struct list_head list;
289 __be16 proto;
290 u16 vid;
291};
292
Gavin Shan2d283bd2016-07-19 11:54:16 +1000293struct ncsi_dev_priv {
294 struct ncsi_dev ndev; /* Associated NCSI device */
295 unsigned int flags; /* NCSI device flags */
Gavin Shane6f44ed2016-07-19 11:54:19 +1000296#define NCSI_DEV_PROBED 1 /* Finalized NCSI topology */
297#define NCSI_DEV_HWA 2 /* Enabled HW arbitration */
298#define NCSI_DEV_RESHUFFLE 4
Samuel Mendoza-Jonas2878a2c2018-11-16 15:51:58 +1100299#define NCSI_DEV_RESET 8 /* Reset state of NC */
Vijay Khemkacb10c7c2018-10-16 12:13:19 -0700300 unsigned int gma_flag; /* OEM GMA flag */
Gavin Shan2d283bd2016-07-19 11:54:16 +1000301 spinlock_t lock; /* Protect the NCSI device */
Gavin Shane6f44ed2016-07-19 11:54:19 +1000302#if IS_ENABLED(CONFIG_IPV6)
303 unsigned int inet6_addr_num; /* Number of IPv6 addresses */
304#endif
Samuel Mendoza-Jonas8e13f702018-11-16 15:51:55 +1100305 unsigned int package_probe_id;/* Current ID during probe */
Gavin Shan2d283bd2016-07-19 11:54:16 +1000306 unsigned int package_num; /* Number of packages */
307 struct list_head packages; /* List of packages */
Gavin Shanbbc7c012016-10-20 11:45:51 +1100308 struct ncsi_channel *hot_channel; /* Channel was ever active */
Gavin Shan2d283bd2016-07-19 11:54:16 +1000309 struct ncsi_request requests[256]; /* Request table */
310 unsigned int request_id; /* Last used request ID */
Gavin Shana15af542016-10-04 11:25:50 +1100311#define NCSI_REQ_START_IDX 1
Gavin Shane6f44ed2016-07-19 11:54:19 +1000312 unsigned int pending_req_num; /* Number of pending requests */
313 struct ncsi_package *active_package; /* Currently handled package */
314 struct ncsi_channel *active_channel; /* Currently handled channel */
315 struct list_head channel_queue; /* Config queue of channels */
316 struct work_struct work; /* For channel management */
317 struct packet_type ptype; /* NCSI packet Rx handler */
Gavin Shan2d283bd2016-07-19 11:54:16 +1000318 struct list_head node; /* Form NCSI device list */
Samuel Mendoza-Jonas6e9c0072017-10-11 16:54:27 +1100319#define NCSI_MAX_VLAN_VIDS 15
Samuel Mendoza-Jonas21acf632017-08-28 16:18:42 +1000320 struct list_head vlan_vids; /* List of active VLAN IDs */
Samuel Mendoza-Jonas8d951a72018-11-16 15:51:59 +1100321
322 bool multi_package; /* Enable multiple packages */
323 u32 package_whitelist; /* Packages to configure */
Gavin Shan2d283bd2016-07-19 11:54:16 +1000324};
325
Gavin Shan6389eaa2016-07-19 11:54:17 +1000326struct ncsi_cmd_arg {
327 struct ncsi_dev_priv *ndp; /* Associated NCSI device */
328 unsigned char type; /* Command in the NCSI packet */
329 unsigned char id; /* Request ID (sequence number) */
330 unsigned char package; /* Destination package ID */
331 unsigned char channel; /* Detination channel ID or 0x1f */
332 unsigned short payload; /* Command packet payload length */
Gavin Shana0509cb2016-10-04 11:25:51 +1100333 unsigned int req_flags; /* NCSI request properties */
Gavin Shan6389eaa2016-07-19 11:54:17 +1000334 union {
335 unsigned char bytes[16]; /* Command packet specific data */
336 unsigned short words[8];
337 unsigned int dwords[4];
338 };
Vijay Khemkafb4ee672018-10-05 10:46:01 -0700339 unsigned char *data; /* NCSI OEM data */
Justin.Lee1@Dell.com9771b8c2018-10-11 18:07:37 +0000340 struct genl_info *info; /* Netlink information */
Gavin Shan6389eaa2016-07-19 11:54:17 +1000341};
342
Gavin Shan2d283bd2016-07-19 11:54:16 +1000343extern struct list_head ncsi_dev_list;
344extern spinlock_t ncsi_dev_lock;
345
346#define TO_NCSI_DEV_PRIV(nd) \
347 container_of(nd, struct ncsi_dev_priv, ndev)
348#define NCSI_FOR_EACH_DEV(ndp) \
349 list_for_each_entry_rcu(ndp, &ncsi_dev_list, node)
350#define NCSI_FOR_EACH_PACKAGE(ndp, np) \
351 list_for_each_entry_rcu(np, &ndp->packages, node)
352#define NCSI_FOR_EACH_CHANNEL(np, nc) \
353 list_for_each_entry_rcu(nc, &np->channels, node)
354
355/* Resources */
Samuel Mendoza-Jonas2878a2c2018-11-16 15:51:58 +1100356int ncsi_reset_dev(struct ncsi_dev *nd);
Gavin Shane6f44ed2016-07-19 11:54:19 +1000357void ncsi_start_channel_monitor(struct ncsi_channel *nc);
358void ncsi_stop_channel_monitor(struct ncsi_channel *nc);
Gavin Shan2d283bd2016-07-19 11:54:16 +1000359struct ncsi_channel *ncsi_find_channel(struct ncsi_package *np,
360 unsigned char id);
361struct ncsi_channel *ncsi_add_channel(struct ncsi_package *np,
362 unsigned char id);
363struct ncsi_package *ncsi_find_package(struct ncsi_dev_priv *ndp,
364 unsigned char id);
365struct ncsi_package *ncsi_add_package(struct ncsi_dev_priv *ndp,
366 unsigned char id);
367void ncsi_remove_package(struct ncsi_package *np);
368void ncsi_find_package_and_channel(struct ncsi_dev_priv *ndp,
369 unsigned char id,
370 struct ncsi_package **np,
371 struct ncsi_channel **nc);
Gavin Shana0509cb2016-10-04 11:25:51 +1100372struct ncsi_request *ncsi_alloc_request(struct ncsi_dev_priv *ndp,
373 unsigned int req_flags);
Gavin Shan2d283bd2016-07-19 11:54:16 +1000374void ncsi_free_request(struct ncsi_request *nr);
375struct ncsi_dev *ncsi_find_dev(struct net_device *dev);
Gavin Shane6f44ed2016-07-19 11:54:19 +1000376int ncsi_process_next_channel(struct ncsi_dev_priv *ndp);
Samuel Mendoza-Jonas8d951a72018-11-16 15:51:59 +1100377bool ncsi_channel_has_link(struct ncsi_channel *channel);
378bool ncsi_channel_is_last(struct ncsi_dev_priv *ndp,
379 struct ncsi_channel *channel);
380int ncsi_update_tx_channel(struct ncsi_dev_priv *ndp,
381 struct ncsi_package *np,
382 struct ncsi_channel *disable,
383 struct ncsi_channel *enable);
Gavin Shan2d283bd2016-07-19 11:54:16 +1000384
Gavin Shan6389eaa2016-07-19 11:54:17 +1000385/* Packet handlers */
386u32 ncsi_calculate_checksum(unsigned char *data, int len);
387int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca);
Gavin Shan138635c2016-07-19 11:54:18 +1000388int ncsi_rcv_rsp(struct sk_buff *skb, struct net_device *dev,
389 struct packet_type *pt, struct net_device *orig_dev);
Gavin Shan7a82ecf2016-07-19 11:54:20 +1000390int ncsi_aen_handler(struct ncsi_dev_priv *ndp, struct sk_buff *skb);
Gavin Shan6389eaa2016-07-19 11:54:17 +1000391
Gavin Shan2d283bd2016-07-19 11:54:16 +1000392#endif /* __NCSI_INTERNAL_H__ */