diff options
author | Mike Marciniszyn <mike.marciniszyn@intel.com> | 2020-01-06 08:42:04 -0500 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2020-01-10 10:57:16 -0400 |
commit | cd47b594dbef7c573c0790026a0ea48273ed2b14 (patch) | |
tree | f81f0990a5f5013ae37c5c08d790b2ad45094c64 /drivers/infiniband/hw/hfi1/hfi.h | |
parent | 7b8a8b72c9eaa631d2065ad50f15eb448b43c352 (diff) | |
download | lwn-cd47b594dbef7c573c0790026a0ea48273ed2b14.tar.gz lwn-cd47b594dbef7c573c0790026a0ea48273ed2b14.zip |
IB/hfi1: IB/hfi1: Add an API to handle special case drop
This patch pushes special case drop logic into an API to be shared by all
interrupt handlers.
Additionally, convert do_drop to a bool.
Link: https://lore.kernel.org/r/20200106134203.119356.36962.stgit@awfm-01.aw.intel.com
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/hfi1/hfi.h')
-rw-r--r-- | drivers/infiniband/hw/hfi1/hfi.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h index 0c643bcd9b17..92125434f820 100644 --- a/drivers/infiniband/hw/hfi1/hfi.h +++ b/drivers/infiniband/hw/hfi1/hfi.h @@ -1316,7 +1316,7 @@ struct hfi1_devdata { struct err_info_constraint err_info_xmit_constraint; atomic_t drop_packet; - u8 do_drop; + bool do_drop; u8 err_info_uncorrectable; u8 err_info_fmconfig; @@ -2462,6 +2462,25 @@ static inline bool is_integrated(struct hfi1_devdata *dd) return dd->pcidev->device == PCI_DEVICE_ID_INTEL1; } +/** + * hfi1_need_drop - detect need for drop + * @dd: - the device + * + * In some cases, the first packet needs to be dropped. + * + * Return true is the current packet needs to be dropped and false otherwise. + */ +static inline bool hfi1_need_drop(struct hfi1_devdata *dd) +{ + if (unlikely(dd->do_drop && + atomic_xchg(&dd->drop_packet, DROP_PACKET_OFF) == + DROP_PACKET_ON)) { + dd->do_drop = false; + return true; + } + return false; +} + int hfi1_tempsense_rd(struct hfi1_devdata *dd, struct hfi1_temp *temp); #define DD_DEV_ENTRY(dd) __string(dev, dev_name(&(dd)->pcidev->dev)) |