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