diff options
author | Sudeep Dutt <sudeep.dutt@intel.com> | 2015-04-29 15:32:37 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-24 22:13:37 +0300 |
commit | fdd9fd5c38afe732258a0af4c6be14f3fbd1585c (patch) | |
tree | acc8c5505bae20a7dcd204e7a477c4df54be8cee /drivers/misc/mic/scif/scif_nodeqp.c | |
parent | 76371c7c0d8642ef30a865df57bf6d186855802d (diff) | |
download | linux-fdd9fd5c38afe732258a0af4c6be14f3fbd1585c.tar.xz |
misc: mic: SCIF messaging and node enumeration APIs
SCIF messaging APIs which allow sending messages between the SCIF
endpoints via a byte stream based ring buffer which has been
optimized to avoid reads across PCIe. The SCIF messaging APIs
are typically used for short < 1024 byte messages for best
performance while the RDMA APIs which will be submitted in a future
patch series is recommended for larger transfers. The node
enumeration API enables a user to query for the number of nodes
online in the SCIF network and their node ids.
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Signed-off-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mic/scif/scif_nodeqp.c')
-rw-r--r-- | drivers/misc/mic/scif/scif_nodeqp.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/drivers/misc/mic/scif/scif_nodeqp.c b/drivers/misc/mic/scif/scif_nodeqp.c index c35451e07cee..41e3bdb10061 100644 --- a/drivers/misc/mic/scif/scif_nodeqp.c +++ b/drivers/misc/mic/scif/scif_nodeqp.c @@ -570,7 +570,10 @@ static char *message_types[] = {"BAD", "CNCT_GNTNACK", "CNCT_REJ", "DISCNCT", - "DISCNT_ACK"}; + "DISCNT_ACK", + "CLIENT_SENT", + "CLIENT_RCVD", + "SCIF_GET_NODE_INFO"}; static void scif_display_message(struct scif_dev *scifdev, struct scifmsg *msg, @@ -951,6 +954,34 @@ scif_node_remove_ack(struct scif_dev *scifdev, struct scifmsg *msg) wake_up(&sdev->disconn_wq); } +/** + * scif_get_node_info: Respond to SCIF_GET_NODE_INFO interrupt message + * @msg: Interrupt message + * + * Retrieve node info i.e maxid and total from the mgmt node. + */ +static __always_inline void +scif_get_node_info_resp(struct scif_dev *scifdev, struct scifmsg *msg) +{ + if (scif_is_mgmt_node()) { + swap(msg->dst.node, msg->src.node); + mutex_lock(&scif_info.conflock); + msg->payload[1] = scif_info.maxid; + msg->payload[2] = scif_info.total; + mutex_unlock(&scif_info.conflock); + scif_nodeqp_send(scifdev, msg); + } else { + struct completion *node_info = + (struct completion *)msg->payload[3]; + + mutex_lock(&scif_info.conflock); + scif_info.maxid = msg->payload[1]; + scif_info.total = msg->payload[2]; + complete_all(node_info); + mutex_unlock(&scif_info.conflock); + } +} + static void scif_msg_unknown(struct scif_dev *scifdev, struct scifmsg *msg) { @@ -978,6 +1009,9 @@ static void (*scif_intr_func[SCIF_MAX_MSG + 1]) scif_cnctrej, /* SCIF_CNCT_REJ */ scif_discnct, /* SCIF_DISCNCT */ scif_discnt_ack, /* SCIF_DISCNT_ACK */ + scif_clientsend, /* SCIF_CLIENT_SENT */ + scif_clientrcvd, /* SCIF_CLIENT_RCVD */ + scif_get_node_info_resp,/* SCIF_GET_NODE_INFO */ }; /** |