mctp: Add SIOCMCTP{ALLOC,DROP}TAG ioctls for tag control
This change adds a couple of new ioctls for mctp sockets: SIOCMCTPALLOCTAG and SIOCMCTPDROPTAG. These ioctls provide facilities for explicit allocation / release of tags, overriding the automatic allocate-on-send/release-on-reply and timeout behaviours. This allows userspace more control over messages that may not fit a simple request/response model. In order to indicate a pre-allocated tag to the sendmsg() syscall, we introduce a new flag to the struct sockaddr_mctp.smctp_tag value: MCTP_TAG_PREALLOC. Additional changes from Jeremy Kerr <jk@codeconstruct.com.au>. Contains a fix that was: Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Matt Johnston <matt@codeconstruct.com.au> Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
0de55a7d11
commit
63ed1aab3d
@@ -126,7 +126,7 @@ struct mctp_sock {
|
||||
*/
|
||||
struct mctp_sk_key {
|
||||
mctp_eid_t peer_addr;
|
||||
mctp_eid_t local_addr;
|
||||
mctp_eid_t local_addr; /* MCTP_ADDR_ANY for local owned tags */
|
||||
__u8 tag; /* incoming tag match; invert TO for local */
|
||||
|
||||
/* we hold a ref to sk when set */
|
||||
@@ -163,6 +163,12 @@ struct mctp_sk_key {
|
||||
*/
|
||||
unsigned long dev_flow_state;
|
||||
struct mctp_dev *dev;
|
||||
|
||||
/* a tag allocated with SIOCMCTPALLOCTAG ioctl will not expire
|
||||
* automatically on timeout or response, instead SIOCMCTPDROPTAG
|
||||
* is used.
|
||||
*/
|
||||
bool manual_alloc;
|
||||
};
|
||||
|
||||
struct mctp_skb_cb {
|
||||
@@ -239,6 +245,9 @@ int mctp_local_output(struct sock *sk, struct mctp_route *rt,
|
||||
struct sk_buff *skb, mctp_eid_t daddr, u8 req_tag);
|
||||
|
||||
void mctp_key_unref(struct mctp_sk_key *key);
|
||||
struct mctp_sk_key *mctp_alloc_local_tag(struct mctp_sock *msk,
|
||||
mctp_eid_t daddr, mctp_eid_t saddr,
|
||||
bool manual, u8 *tagp);
|
||||
|
||||
/* routing <--> device interface */
|
||||
unsigned int mctp_default_net(struct net *net);
|
||||
|
||||
Reference in New Issue
Block a user