stats: i2c: I2C stats

Adds the ability for I2C drivers to report synchronous transfer stats
using a I2C specific macro to define the device instance.

The macro creates a container for device_state which allows for per
instance device class common data structure to be used in the device
class api (ex: i2c.h). This is used to maintain per driver instance
stats for all i2c drivers. This is a reusable idea across other device
classes as desired.

Using Kconfig device class stats may be turned on/off individually
this way as well, in this case I2C_STATS.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
This commit is contained in:
Tom Burdick 2021-10-27 15:07:10 -05:00 committed by Anas Nashif
commit 7b1349cfe6
37 changed files with 253 additions and 66 deletions

View file

@ -2250,9 +2250,11 @@ struct net_if_api {
#define Z_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
pm_action_cb, data, cfg, prio, api, l2, \
l2_ctx_type, mtu) \
Z_DEVICE_STATE_DEFINE(node_id, dev_name) \
Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
pm_action_cb, data, \
cfg, POST_KERNEL, prio, api); \
cfg, POST_KERNEL, prio, api, \
&Z_DEVICE_STATE_NAME(dev_name)); \
NET_L2_DATA_INIT(dev_name, 0, l2_ctx_type); \
NET_IF_INIT(dev_name, 0, l2, mtu, NET_IF_MAX_CONFIGS)
@ -2328,9 +2330,10 @@ struct net_if_api {
instance, init_fn, pm_action_cb, \
data, cfg, prio, api, l2, \
l2_ctx_type, mtu) \
Z_DEVICE_STATE_DEFINE(node_id, dev_name) \
Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
pm_action_cb, data, cfg, POST_KERNEL, \
prio, api); \
prio, api, &Z_DEVICE_STATE_NAME(dev_name)); \
NET_L2_DATA_INIT(dev_name, instance, l2_ctx_type); \
NET_IF_INIT(dev_name, instance, l2, mtu, NET_IF_MAX_CONFIGS)
@ -2417,8 +2420,10 @@ struct net_if_api {
#define Z_NET_DEVICE_OFFLOAD_INIT(node_id, dev_name, drv_name, init_fn, \
pm_action_cb, data, cfg, prio, \
api, mtu) \
Z_DEVICE_STATE_DEFINE(node_id, dev_name) \
Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
pm_action_cb, data, cfg, POST_KERNEL, prio, api);\
pm_action_cb, data, cfg, POST_KERNEL, prio, api, \
&Z_DEVICE_STATE_NAME(dev_name)); \
NET_IF_OFFLOAD_INIT(dev_name, 0, mtu)
/**