Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __NET_NCSI_H
0003 #define __NET_NCSI_H
0004 
0005 #include <linux/types.h>
0006 
0007 /*
0008  * The NCSI device states seen from external. More NCSI device states are
0009  * only visible internally (in net/ncsi/internal.h). When the NCSI device
0010  * is registered, it's in ncsi_dev_state_registered state. The state
0011  * ncsi_dev_state_start is used to drive to choose active package and
0012  * channel. After that, its state is changed to ncsi_dev_state_functional.
0013  *
0014  * The state ncsi_dev_state_stop helps to shut down the currently active
0015  * package and channel while ncsi_dev_state_config helps to reconfigure
0016  * them.
0017  */
0018 enum {
0019     ncsi_dev_state_registered   = 0x0000,
0020     ncsi_dev_state_functional   = 0x0100,
0021     ncsi_dev_state_probe        = 0x0200,
0022     ncsi_dev_state_config       = 0x0300,
0023     ncsi_dev_state_suspend      = 0x0400,
0024 };
0025 
0026 struct ncsi_dev {
0027     int               state;
0028     int       link_up;
0029     struct net_device *dev;
0030     void          (*handler)(struct ncsi_dev *ndev);
0031 };
0032 
0033 #ifdef CONFIG_NET_NCSI
0034 int ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid);
0035 int ncsi_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid);
0036 struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
0037                    void (*notifier)(struct ncsi_dev *nd));
0038 int ncsi_start_dev(struct ncsi_dev *nd);
0039 void ncsi_stop_dev(struct ncsi_dev *nd);
0040 void ncsi_unregister_dev(struct ncsi_dev *nd);
0041 #else /* !CONFIG_NET_NCSI */
0042 static inline int ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid)
0043 {
0044     return -EINVAL;
0045 }
0046 
0047 static inline int ncsi_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)
0048 {
0049     return -EINVAL;
0050 }
0051 
0052 static inline struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
0053                     void (*notifier)(struct ncsi_dev *nd))
0054 {
0055     return NULL;
0056 }
0057 
0058 static inline int ncsi_start_dev(struct ncsi_dev *nd)
0059 {
0060     return -ENOTTY;
0061 }
0062 
0063 static void ncsi_stop_dev(struct ncsi_dev *nd)
0064 {
0065 }
0066 
0067 static inline void ncsi_unregister_dev(struct ncsi_dev *nd)
0068 {
0069 }
0070 #endif /* CONFIG_NET_NCSI */
0071 
0072 #endif /* __NET_NCSI_H */