blob: fbefe80361eea1f1873e4a4ea60291c35b707051 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Gavin Shan2d283bd2016-07-19 11:54:16 +10002#ifndef __NET_NCSI_H
3#define __NET_NCSI_H
4
5/*
6 * The NCSI device states seen from external. More NCSI device states are
7 * only visible internally (in net/ncsi/internal.h). When the NCSI device
8 * is registered, it's in ncsi_dev_state_registered state. The state
9 * ncsi_dev_state_start is used to drive to choose active package and
10 * channel. After that, its state is changed to ncsi_dev_state_functional.
11 *
12 * The state ncsi_dev_state_stop helps to shut down the currently active
13 * package and channel while ncsi_dev_state_config helps to reconfigure
14 * them.
15 */
16enum {
17 ncsi_dev_state_registered = 0x0000,
18 ncsi_dev_state_functional = 0x0100,
19 ncsi_dev_state_probe = 0x0200,
20 ncsi_dev_state_config = 0x0300,
21 ncsi_dev_state_suspend = 0x0400,
22};
23
24struct ncsi_dev {
25 int state;
26 int link_up;
27 struct net_device *dev;
28 void (*handler)(struct ncsi_dev *ndev);
29};
30
31#ifdef CONFIG_NET_NCSI
Samuel Mendoza-Jonas21acf632017-08-28 16:18:42 +100032int ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid);
33int ncsi_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid);
Gavin Shan2d283bd2016-07-19 11:54:16 +100034struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
35 void (*notifier)(struct ncsi_dev *nd));
Gavin Shane6f44ed2016-07-19 11:54:19 +100036int ncsi_start_dev(struct ncsi_dev *nd);
Gavin Shanc0cd1ba2016-10-04 11:25:53 +110037void ncsi_stop_dev(struct ncsi_dev *nd);
Gavin Shan2d283bd2016-07-19 11:54:16 +100038void ncsi_unregister_dev(struct ncsi_dev *nd);
39#else /* !CONFIG_NET_NCSI */
Arnd Bergmannfd0c88b2017-09-05 10:05:47 +020040static inline int ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid)
41{
42 return -EINVAL;
43}
44
45static inline int ncsi_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)
46{
47 return -EINVAL;
48}
49
Gavin Shan2d283bd2016-07-19 11:54:16 +100050static inline struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
51 void (*notifier)(struct ncsi_dev *nd))
52{
53 return NULL;
54}
55
Gavin Shane6f44ed2016-07-19 11:54:19 +100056static inline int ncsi_start_dev(struct ncsi_dev *nd)
57{
58 return -ENOTTY;
59}
60
Gavin Shanc0cd1ba2016-10-04 11:25:53 +110061static void ncsi_stop_dev(struct ncsi_dev *nd)
62{
63}
64
Gavin Shan2d283bd2016-07-19 11:54:16 +100065static inline void ncsi_unregister_dev(struct ncsi_dev *nd)
66{
67}
68#endif /* CONFIG_NET_NCSI */
69
70#endif /* __NET_NCSI_H */