net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 11:54:16 +10:00
# ifndef __NET_NCSI_H
# define __NET_NCSI_H
/*
* The NCSI device states seen from external . More NCSI device states are
* only visible internally ( in net / ncsi / internal . h ) . When the NCSI device
* is registered , it ' s in ncsi_dev_state_registered state . The state
* ncsi_dev_state_start is used to drive to choose active package and
* channel . After that , its state is changed to ncsi_dev_state_functional .
*
* The state ncsi_dev_state_stop helps to shut down the currently active
* package and channel while ncsi_dev_state_config helps to reconfigure
* them .
*/
enum {
ncsi_dev_state_registered = 0x0000 ,
ncsi_dev_state_functional = 0x0100 ,
ncsi_dev_state_probe = 0x0200 ,
ncsi_dev_state_config = 0x0300 ,
ncsi_dev_state_suspend = 0x0400 ,
} ;
struct ncsi_dev {
int state ;
int link_up ;
struct net_device * dev ;
void ( * handler ) ( struct ncsi_dev * ndev ) ;
} ;
# ifdef CONFIG_NET_NCSI
struct ncsi_dev * ncsi_register_dev ( struct net_device * dev ,
void ( * notifier ) ( struct ncsi_dev * nd ) ) ;
2016-07-19 11:54:19 +10:00
int ncsi_start_dev ( struct ncsi_dev * nd ) ;
2016-10-04 11:25:53 +11:00
void ncsi_stop_dev ( struct ncsi_dev * nd ) ;
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 11:54:16 +10:00
void ncsi_unregister_dev ( struct ncsi_dev * nd ) ;
# else /* !CONFIG_NET_NCSI */
static inline struct ncsi_dev * ncsi_register_dev ( struct net_device * dev ,
void ( * notifier ) ( struct ncsi_dev * nd ) )
{
return NULL ;
}
2016-07-19 11:54:19 +10:00
static inline int ncsi_start_dev ( struct ncsi_dev * nd )
{
return - ENOTTY ;
}
2016-10-04 11:25:53 +11:00
static void ncsi_stop_dev ( struct ncsi_dev * nd )
{
}
net/ncsi: Resource management
NCSI spec (DSP0222) defines several objects: package, channel, mode,
filter, version and statistics etc. This introduces the data structs
to represent those objects and implement functions to manage them.
Also, this introduces CONFIG_NET_NCSI for the newly implemented NCSI
stack.
* The user (e.g. netdev driver) dereference NCSI device by
"struct ncsi_dev", which is embedded to "struct ncsi_dev_priv".
The later one is used by NCSI stack internally.
* Every NCSI device can have multiple packages simultaneously, up
to 8 packages. It's represented by "struct ncsi_package" and
identified by 3-bits ID.
* Every NCSI package can have multiple channels, up to 32. It's
represented by "struct ncsi_channel" and identified by 5-bits ID.
* Every NCSI channel has version, statistics, various modes and
filters. They are represented by "struct ncsi_channel_version",
"struct ncsi_channel_stats", "struct ncsi_channel_mode" and
"struct ncsi_channel_filter" separately.
* Apart from AEN (Asynchronous Event Notification), the NCSI stack
works in terms of command and response. This introduces "struct
ncsi_req" to represent a complete NCSI transaction made of NCSI
request and response.
link: https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.1.0.pdf
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-19 11:54:16 +10:00
static inline void ncsi_unregister_dev ( struct ncsi_dev * nd )
{
}
# endif /* CONFIG_NET_NCSI */
# endif /* __NET_NCSI_H */