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