18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __NET_NCSI_H 38c2ecf20Sopenharmony_ci#define __NET_NCSI_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* 68c2ecf20Sopenharmony_ci * The NCSI device states seen from external. More NCSI device states are 78c2ecf20Sopenharmony_ci * only visible internally (in net/ncsi/internal.h). When the NCSI device 88c2ecf20Sopenharmony_ci * is registered, it's in ncsi_dev_state_registered state. The state 98c2ecf20Sopenharmony_ci * ncsi_dev_state_start is used to drive to choose active package and 108c2ecf20Sopenharmony_ci * channel. After that, its state is changed to ncsi_dev_state_functional. 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * The state ncsi_dev_state_stop helps to shut down the currently active 138c2ecf20Sopenharmony_ci * package and channel while ncsi_dev_state_config helps to reconfigure 148c2ecf20Sopenharmony_ci * them. 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_cienum { 178c2ecf20Sopenharmony_ci ncsi_dev_state_registered = 0x0000, 188c2ecf20Sopenharmony_ci ncsi_dev_state_functional = 0x0100, 198c2ecf20Sopenharmony_ci ncsi_dev_state_probe = 0x0200, 208c2ecf20Sopenharmony_ci ncsi_dev_state_config = 0x0300, 218c2ecf20Sopenharmony_ci ncsi_dev_state_suspend = 0x0400, 228c2ecf20Sopenharmony_ci}; 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_cistruct ncsi_dev { 258c2ecf20Sopenharmony_ci int state; 268c2ecf20Sopenharmony_ci int link_up; 278c2ecf20Sopenharmony_ci struct net_device *dev; 288c2ecf20Sopenharmony_ci void (*handler)(struct ncsi_dev *ndev); 298c2ecf20Sopenharmony_ci}; 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#ifdef CONFIG_NET_NCSI 328c2ecf20Sopenharmony_ciint ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid); 338c2ecf20Sopenharmony_ciint ncsi_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid); 348c2ecf20Sopenharmony_cistruct ncsi_dev *ncsi_register_dev(struct net_device *dev, 358c2ecf20Sopenharmony_ci void (*notifier)(struct ncsi_dev *nd)); 368c2ecf20Sopenharmony_ciint ncsi_start_dev(struct ncsi_dev *nd); 378c2ecf20Sopenharmony_civoid ncsi_stop_dev(struct ncsi_dev *nd); 388c2ecf20Sopenharmony_civoid ncsi_unregister_dev(struct ncsi_dev *nd); 398c2ecf20Sopenharmony_ci#else /* !CONFIG_NET_NCSI */ 408c2ecf20Sopenharmony_cistatic inline int ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) 418c2ecf20Sopenharmony_ci{ 428c2ecf20Sopenharmony_ci return -EINVAL; 438c2ecf20Sopenharmony_ci} 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cistatic inline int ncsi_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid) 468c2ecf20Sopenharmony_ci{ 478c2ecf20Sopenharmony_ci return -EINVAL; 488c2ecf20Sopenharmony_ci} 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_cistatic inline struct ncsi_dev *ncsi_register_dev(struct net_device *dev, 518c2ecf20Sopenharmony_ci void (*notifier)(struct ncsi_dev *nd)) 528c2ecf20Sopenharmony_ci{ 538c2ecf20Sopenharmony_ci return NULL; 548c2ecf20Sopenharmony_ci} 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_cistatic inline int ncsi_start_dev(struct ncsi_dev *nd) 578c2ecf20Sopenharmony_ci{ 588c2ecf20Sopenharmony_ci return -ENOTTY; 598c2ecf20Sopenharmony_ci} 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cistatic void ncsi_stop_dev(struct ncsi_dev *nd) 628c2ecf20Sopenharmony_ci{ 638c2ecf20Sopenharmony_ci} 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_cistatic inline void ncsi_unregister_dev(struct ncsi_dev *nd) 668c2ecf20Sopenharmony_ci{ 678c2ecf20Sopenharmony_ci} 688c2ecf20Sopenharmony_ci#endif /* CONFIG_NET_NCSI */ 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#endif /* __NET_NCSI_H */ 71