1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 #ifndef __NET_NCSI_H 1 #ifndef __NET_NCSI_H 3 #define __NET_NCSI_H 2 #define __NET_NCSI_H 4 3 5 #include <linux/types.h> << 6 << 7 /* 4 /* 8 * The NCSI device states seen from external. 5 * The NCSI device states seen from external. More NCSI device states are 9 * only visible internally (in net/ncsi/intern 6 * only visible internally (in net/ncsi/internal.h). When the NCSI device 10 * is registered, it's in ncsi_dev_state_regis 7 * is registered, it's in ncsi_dev_state_registered state. The state 11 * ncsi_dev_state_start is used to drive to ch 8 * ncsi_dev_state_start is used to drive to choose active package and 12 * channel. After that, its state is changed t 9 * channel. After that, its state is changed to ncsi_dev_state_functional. 13 * 10 * 14 * The state ncsi_dev_state_stop helps to shut 11 * The state ncsi_dev_state_stop helps to shut down the currently active 15 * package and channel while ncsi_dev_state_co 12 * package and channel while ncsi_dev_state_config helps to reconfigure 16 * them. 13 * them. 17 */ 14 */ 18 enum { 15 enum { 19 ncsi_dev_state_registered = 0x00 16 ncsi_dev_state_registered = 0x0000, 20 ncsi_dev_state_functional = 0x01 17 ncsi_dev_state_functional = 0x0100, 21 ncsi_dev_state_probe = 0x02 18 ncsi_dev_state_probe = 0x0200, 22 ncsi_dev_state_config = 0x03 19 ncsi_dev_state_config = 0x0300, 23 ncsi_dev_state_suspend = 0x04 20 ncsi_dev_state_suspend = 0x0400, 24 }; 21 }; 25 22 26 struct ncsi_dev { 23 struct ncsi_dev { 27 int state; 24 int state; 28 int link_up; 25 int link_up; 29 struct net_device *dev; 26 struct net_device *dev; 30 void (*handler)(struct nc 27 void (*handler)(struct ncsi_dev *ndev); 31 }; 28 }; 32 29 33 #ifdef CONFIG_NET_NCSI 30 #ifdef CONFIG_NET_NCSI 34 int ncsi_vlan_rx_add_vid(struct net_device *de << 35 int ncsi_vlan_rx_kill_vid(struct net_device *d << 36 struct ncsi_dev *ncsi_register_dev(struct net_ 31 struct ncsi_dev *ncsi_register_dev(struct net_device *dev, 37 void (*noti 32 void (*notifier)(struct ncsi_dev *nd)); 38 int ncsi_start_dev(struct ncsi_dev *nd); 33 int ncsi_start_dev(struct ncsi_dev *nd); 39 void ncsi_stop_dev(struct ncsi_dev *nd); 34 void ncsi_stop_dev(struct ncsi_dev *nd); 40 void ncsi_unregister_dev(struct ncsi_dev *nd); 35 void ncsi_unregister_dev(struct ncsi_dev *nd); 41 #else /* !CONFIG_NET_NCSI */ 36 #else /* !CONFIG_NET_NCSI */ 42 static inline int ncsi_vlan_rx_add_vid(struct << 43 { << 44 return -EINVAL; << 45 } << 46 << 47 static inline int ncsi_vlan_rx_kill_vid(struct << 48 { << 49 return -EINVAL; << 50 } << 51 << 52 static inline struct ncsi_dev *ncsi_register_d 37 static inline struct ncsi_dev *ncsi_register_dev(struct net_device *dev, 53 void ( 38 void (*notifier)(struct ncsi_dev *nd)) 54 { 39 { 55 return NULL; 40 return NULL; 56 } 41 } 57 42 58 static inline int ncsi_start_dev(struct ncsi_d 43 static inline int ncsi_start_dev(struct ncsi_dev *nd) 59 { 44 { 60 return -ENOTTY; 45 return -ENOTTY; 61 } 46 } 62 47 63 static void ncsi_stop_dev(struct ncsi_dev *nd) 48 static void ncsi_stop_dev(struct ncsi_dev *nd) 64 { 49 { 65 } 50 } 66 51 67 static inline void ncsi_unregister_dev(struct 52 static inline void ncsi_unregister_dev(struct ncsi_dev *nd) 68 { 53 { 69 } 54 } 70 #endif /* CONFIG_NET_NCSI */ 55 #endif /* CONFIG_NET_NCSI */ 71 56 72 #endif /* __NET_NCSI_H */ 57 #endif /* __NET_NCSI_H */ 73 58
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.