diff options
author | Serge Semin <fancer.lancer@gmail.com> | 2016-12-20 12:48:20 +0300 |
---|---|---|
committer | Jon Mason <jdmason@kudzu.us> | 2017-07-06 11:30:07 -0400 |
commit | bc3e49adc279c5505d6df8dd8c7fca45d6d3d21a (patch) | |
tree | 565b2b2bcbc04243e69661e6d067a8ada86517ac /drivers | |
parent | d67288a39584daad11edee9b03d53264ba147453 (diff) | |
download | linux-bc3e49adc279c5505d6df8dd8c7fca45d6d3d21a.tar.bz2 |
NTB: Add Messaging NTB API
Some IDT NTB-capable PCIe-switches have message registers to communicate with
peer devices. This patch adds new NTB API callback methods, which can be used
to utilize these registers functionality:
ntb_msg_count(); - get number of message registers
ntb_msg_inbits(); - get bitfield of inbound message registers status
ntb_msg_outbits(); - get bitfield of outbound message registers status
ntb_msg_read_sts(); - read the inbound and outbound message registers status
ntb_msg_clear_sts(); - clear status bits of message registers
ntb_msg_set_mask(); - mask interrupts raised by status bits of message
registers.
ntb_msg_clear_mask(); - clear interrupts mask bits of message registers
ntb_msg_read(midx, *pidx); - read message register with specified index,
additionally getting peer port index which data received from
ntb_msg_write(midx, pidx); - write data to the specified message register
sending it to the passed peer device connected over a pidx port
ntb_msg_event(); - notify driver context of a new message event
Of course there is hardware which doesn't support Message registers, so
this API is made optional.
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Acked-by: Allen Hubbe <Allen.Hubbe@dell.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ntb/ntb.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/ntb/ntb.c b/drivers/ntb/ntb.c index 2551bb2ff4a4..03b80d89b980 100644 --- a/drivers/ntb/ntb.c +++ b/drivers/ntb/ntb.c @@ -193,6 +193,19 @@ void ntb_db_event(struct ntb_dev *ntb, int vector) } EXPORT_SYMBOL(ntb_db_event); +void ntb_msg_event(struct ntb_dev *ntb) +{ + unsigned long irqflags; + + spin_lock_irqsave(&ntb->ctx_lock, irqflags); + { + if (ntb->ctx_ops && ntb->ctx_ops->msg_event) + ntb->ctx_ops->msg_event(ntb->ctx); + } + spin_unlock_irqrestore(&ntb->ctx_lock, irqflags); +} +EXPORT_SYMBOL(ntb_msg_event); + int ntb_default_port_number(struct ntb_dev *ntb) { switch (ntb->topo) { |