diff options
| author | David S. Miller <[email protected]> | 2021-10-29 13:23:51 +0100 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2021-10-29 13:23:51 +0100 |
| commit | 6689d716fded86e5b85309537e2c42945763eeea (patch) | |
| tree | 77003311252e189a9ea63792d9fa7f0f09175119 /include | |
| parent | e311eb9192497a20199c68181d58cb61871f1f86 (diff) | |
| parent | 67737c457281dd199ceb9e31b6ba7efd3bfe566d (diff) | |
Merge branch 'MCTP-flow-support'
Jeremy Kerr says:
====================
MCTP flow support
For certain MCTP transport bindings, the binding driver will need to be
aware of request/response pairing. For example, the i2c binding may need
to set multiplexer configuration when expecting a response from a device
behind a mux.
This series implements a mechanism for informing the driver about these
flows, so it can implement transport-specific behaviour when a flow is
in progress (ie, a response is expected, and/or we time-out on that
expectation). We use a skb extension to notify the driver about the
presence of a flow, and a new dev->ops callback to notify about a flow's
destruction.
====================
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/skbuff.h | 3 | ||||
| -rw-r--r-- | include/net/mctp.h | 13 | ||||
| -rw-r--r-- | include/net/mctpdevice.h | 16 |
3 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index cb96f1e6460c..0bd6520329f6 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -4244,6 +4244,9 @@ enum skb_ext_id { #if IS_ENABLED(CONFIG_MPTCP) SKB_EXT_MPTCP, #endif +#if IS_ENABLED(CONFIG_MCTP_FLOWS) + SKB_EXT_MCTP, +#endif SKB_EXT_NUM, /* must be last */ }; diff --git a/include/net/mctp.h b/include/net/mctp.h index 23bec708f4c7..7e35ec79b909 100644 --- a/include/net/mctp.h +++ b/include/net/mctp.h @@ -152,6 +152,12 @@ struct mctp_sk_key { /* expiry timeout; valid (above) cleared on expiry */ unsigned long expiry; + + /* free to use for device flow state tracking. Initialised to + * zero on initial key creation + */ + unsigned long dev_flow_state; + struct mctp_dev *dev; }; struct mctp_skb_cb { @@ -189,6 +195,13 @@ static inline struct mctp_skb_cb *mctp_cb(struct sk_buff *skb) return (void *)(skb->cb); } +/* If CONFIG_MCTP_FLOWS, we may add one of these as a SKB extension, + * indicating the flow to the device driver. + */ +struct mctp_flow { + struct mctp_sk_key *key; +}; + /* Route definition. * * These are held in the pernet->mctp.routes list, with RCU protection for diff --git a/include/net/mctpdevice.h b/include/net/mctpdevice.h index 3a439463f055..5c0d04b5c12c 100644 --- a/include/net/mctpdevice.h +++ b/include/net/mctpdevice.h @@ -14,6 +14,8 @@ #include <linux/types.h> #include <linux/refcount.h> +struct mctp_sk_key; + struct mctp_dev { struct net_device *dev; @@ -21,6 +23,8 @@ struct mctp_dev { unsigned int net; + const struct mctp_netdev_ops *ops; + /* Only modified under RTNL. Reads have addrs_lock held */ u8 *addrs; size_t num_addrs; @@ -29,12 +33,24 @@ struct mctp_dev { struct rcu_head rcu; }; +struct mctp_netdev_ops { + void (*release_flow)(struct mctp_dev *dev, + struct mctp_sk_key *key); +}; + #define MCTP_INITIAL_DEFAULT_NET 1 struct mctp_dev *mctp_dev_get_rtnl(const struct net_device *dev); struct mctp_dev *__mctp_dev_get(const struct net_device *dev); +int mctp_register_netdev(struct net_device *dev, + const struct mctp_netdev_ops *ops); +void mctp_unregister_netdev(struct net_device *dev); + void mctp_dev_hold(struct mctp_dev *mdev); void mctp_dev_put(struct mctp_dev *mdev); +void mctp_dev_set_key(struct mctp_dev *dev, struct mctp_sk_key *key); +void mctp_dev_release_key(struct mctp_dev *dev, struct mctp_sk_key *key); + #endif /* __NET_MCTPDEVICE_H */ |