svn commit: r289343 - head/sys/dev/ntb/ntb_hw

Conrad E. Meyer cem at FreeBSD.org
Wed Oct 14 23:47:09 UTC 2015


Author: cem
Date: Wed Oct 14 23:47:08 2015
New Revision: 289343
URL: https://svnweb.freebsd.org/changeset/base/289343

Log:
  NTB: Reserve link event doorbell callback on Xeon
  
  Consumers that registered on this bit would never see a callback and it
  is likely a mistake.
  
  This does not affect if_ntb, which limits itself to a single doorbell
  callback.

Modified:
  head/sys/dev/ntb/ntb_hw/ntb_hw.c

Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c
==============================================================================
--- head/sys/dev/ntb/ntb_hw/ntb_hw.c	Wed Oct 14 23:46:15 2015	(r289342)
+++ head/sys/dev/ntb/ntb_hw/ntb_hw.c	Wed Oct 14 23:47:08 2015	(r289343)
@@ -110,6 +110,7 @@ struct ntb_db_cb {
 	void			*data;
 	struct ntb_softc	*ntb;
 	struct callout		irq_work;
+	bool			reserved;
 };
 
 struct ntb_softc {
@@ -513,6 +514,12 @@ ntb_setup_xeon_msix(struct ntb_softc *nt
 			return (ENXIO);
 		}
 	}
+
+	/*
+	 * Prevent consumers from registering callbacks on the link event irq
+	 * slot, from which they will never be called back.
+	 */
+	ntb->db_cb[num_vectors - 1].reserved = true;
 	return (0);
 }
 
@@ -1302,15 +1309,17 @@ int
 ntb_register_db_callback(struct ntb_softc *ntb, unsigned int idx, void *data,
     ntb_db_callback func)
 {
+	struct ntb_db_cb *db_cb = &ntb->db_cb[idx];
 
-	if (idx >= ntb->allocated_interrupts || ntb->db_cb[idx].callback) {
+	if (idx >= ntb->allocated_interrupts || db_cb->callback ||
+	    db_cb->reserved) {
 		device_printf(ntb->device, "Invalid Index.\n");
 		return (EINVAL);
 	}
 
-	ntb->db_cb[idx].callback = func;
-	ntb->db_cb[idx].data = data;
-	callout_init(&ntb->db_cb[idx].irq_work, 1);
+	db_cb->callback = func;
+	db_cb->data = data;
+	callout_init(&db_cb->irq_work, 1);
 
 	unmask_ldb_interrupt(ntb, idx);
 


More information about the svn-src-head mailing list