svn commit: r289255 - in head/sys/dev/ntb: if_ntb ntb_hw
Conrad E. Meyer
cem at FreeBSD.org
Tue Oct 13 19:44:26 UTC 2015
Author: cem
Date: Tue Oct 13 19:44:25 2015
New Revision: 289255
URL: https://svnweb.freebsd.org/changeset/base/289255
Log:
NTB: MFV 49793889: Rename Variables for NTB-RP
Many variable names in the NTB driver refer to the primary or secondary
side. However, these variables will be used to access the reverse case
when in NTB-RP mode. Make these names more generic in anticipation of
NTB-RP support.
Authored by: Jon Mason
Obtained from: Linux
Sponsored by: EMC / Isilon Storage Division
Modified:
head/sys/dev/ntb/if_ntb/if_ntb.c
head/sys/dev/ntb/ntb_hw/ntb_hw.c
head/sys/dev/ntb/ntb_hw/ntb_hw.h
Modified: head/sys/dev/ntb/if_ntb/if_ntb.c
==============================================================================
--- head/sys/dev/ntb/if_ntb/if_ntb.c Tue Oct 13 19:42:57 2015 (r289254)
+++ head/sys/dev/ntb/if_ntb/if_ntb.c Tue Oct 13 19:44:25 2015 (r289255)
@@ -809,7 +809,7 @@ ntb_tx_copy_task(struct ntb_transport_qp
/* TODO: replace with bus_space_write */
hdr->flags = entry->flags | IF_NTB_DESC_DONE_FLAG;
- ntb_ring_sdb(qp->ntb, qp->qp_num);
+ ntb_ring_doorbell(qp->ntb, qp->qp_num);
/*
* The entry length can only be zero if the packet is intended to be a
Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c
==============================================================================
--- head/sys/dev/ntb/ntb_hw/ntb_hw.c Tue Oct 13 19:42:57 2015 (r289254)
+++ head/sys/dev/ntb/ntb_hw/ntb_hw.c Tue Oct 13 19:44:25 2015 (r289255)
@@ -133,11 +133,11 @@ struct ntb_softc {
uint8_t msix_cnt;
} limits;
struct {
- uint32_t pdb;
- uint32_t pdb_mask;
- uint32_t sdb;
- uint32_t sbar2_xlat;
- uint32_t sbar4_xlat;
+ uint32_t ldb;
+ uint32_t ldb_mask;
+ uint32_t rdb;
+ uint32_t bar2_xlat;
+ uint32_t bar4_xlat;
uint32_t spad_remote;
uint32_t spad_local;
uint32_t lnk_cntl;
@@ -476,9 +476,9 @@ ntb_setup_interrupts(struct ntb_softc *n
* Interrupt. The rest will be unmasked as callbacks are registered.
*/
if (ntb->type == NTB_SOC)
- ntb_reg_write(8, ntb->reg_ofs.pdb_mask, ~0);
+ ntb_reg_write(8, ntb->reg_ofs.ldb_mask, ~0);
else
- ntb_reg_write(2, ntb->reg_ofs.pdb_mask,
+ ntb_reg_write(2, ntb->reg_ofs.ldb_mask,
~(1 << ntb->limits.max_db_bits));
num_vectors = MIN(pci_msix_count(ntb->device),
@@ -578,7 +578,7 @@ handle_soc_irq(void *arg)
struct ntb_db_cb *db_cb = arg;
struct ntb_softc *ntb = db_cb->ntb;
- ntb_reg_write(8, ntb->reg_ofs.pdb, (uint64_t) 1 << db_cb->db_num);
+ ntb_reg_write(8, ntb->reg_ofs.ldb, (uint64_t) 1 << db_cb->db_num);
if (db_cb->callback != NULL)
db_cb->callback(db_cb->data, db_cb->db_num);
@@ -596,7 +596,7 @@ handle_xeon_irq(void *arg)
* vectors, with the 4th having a single bit for link
* interrupts.
*/
- ntb_reg_write(2, ntb->reg_ofs.pdb,
+ ntb_reg_write(2, ntb->reg_ofs.ldb,
((1 << ntb->bits_per_vector) - 1) <<
(db_cb->db_num * ntb->bits_per_vector));
@@ -616,7 +616,7 @@ handle_xeon_event_irq(void *arg)
device_printf(ntb->device, "Error determining link status\n");
/* bit 15 is always the link bit */
- ntb_reg_write(2, ntb->reg_ofs.pdb, 1 << ntb->limits.max_db_bits);
+ ntb_reg_write(2, ntb->reg_ofs.ldb, 1 << ntb->limits.max_db_bits);
}
static void
@@ -624,28 +624,28 @@ ntb_handle_legacy_interrupt(void *arg)
{
struct ntb_softc *ntb = arg;
unsigned int i = 0;
- uint64_t pdb64;
- uint16_t pdb16;
+ uint64_t ldb64;
+ uint16_t ldb16;
if (ntb->type == NTB_SOC) {
- pdb64 = ntb_reg_read(8, ntb->reg_ofs.pdb);
+ ldb64 = ntb_reg_read(8, ntb->reg_ofs.ldb);
- while (pdb64) {
- i = ffs(pdb64);
- pdb64 &= pdb64 - 1;
+ while (ldb64) {
+ i = ffs(ldb64);
+ ldb64 &= ldb64 - 1;
handle_soc_irq(&ntb->db_cb[i]);
}
} else {
- pdb16 = ntb_reg_read(2, ntb->reg_ofs.pdb);
+ ldb16 = ntb_reg_read(2, ntb->reg_ofs.ldb);
- if ((pdb16 & XEON_DB_HW_LINK) != 0) {
+ if ((ldb16 & XEON_DB_HW_LINK) != 0) {
handle_xeon_event_irq(ntb);
- pdb16 &= ~XEON_DB_HW_LINK;
+ ldb16 &= ~XEON_DB_HW_LINK;
}
- while (pdb16 != 0) {
- i = ffs(pdb16);
- pdb16 &= pdb16 - 1;
+ while (ldb16 != 0) {
+ i = ffs(ldb16);
+ ldb16 &= ldb16 - 1;
handle_xeon_irq(&ntb->db_cb[i]);
}
}
@@ -726,10 +726,10 @@ ntb_setup_xeon(struct ntb_softc *ntb)
else
ntb->dev_type = NTB_DEV_DSD;
- ntb->reg_ofs.pdb = XEON_PDOORBELL_OFFSET;
- ntb->reg_ofs.pdb_mask = XEON_PDBMSK_OFFSET;
- ntb->reg_ofs.sbar2_xlat = XEON_SBAR2XLAT_OFFSET;
- ntb->reg_ofs.sbar4_xlat = XEON_SBAR4XLAT_OFFSET;
+ ntb->reg_ofs.ldb = XEON_PDOORBELL_OFFSET;
+ ntb->reg_ofs.ldb_mask = XEON_PDBMSK_OFFSET;
+ ntb->reg_ofs.bar2_xlat = XEON_SBAR2XLAT_OFFSET;
+ ntb->reg_ofs.bar4_xlat = XEON_SBAR4XLAT_OFFSET;
ntb->reg_ofs.lnk_cntl = XEON_NTBCNTL_OFFSET;
ntb->reg_ofs.lnk_stat = XEON_LINK_STATUS_OFFSET;
ntb->reg_ofs.spad_local = XEON_SPAD_OFFSET;
@@ -758,16 +758,16 @@ ntb_setup_xeon(struct ntb_softc *ntb)
if (ntb->conn_type == NTB_CONN_B2B) {
- ntb->reg_ofs.sdb = XEON_B2B_DOORBELL_OFFSET;
+ ntb->reg_ofs.rdb = XEON_B2B_DOORBELL_OFFSET;
ntb->reg_ofs.spad_remote = XEON_B2B_SPAD_OFFSET;
ntb->limits.max_spads = XEON_MAX_SPADS;
} else {
- ntb->reg_ofs.sdb = XEON_SDOORBELL_OFFSET;
+ ntb->reg_ofs.rdb = XEON_SDOORBELL_OFFSET;
ntb->reg_ofs.spad_remote = XEON_SPAD_OFFSET;
ntb->limits.max_spads = XEON_MAX_COMPAT_SPADS;
}
- ntb->limits.max_db_bits = XEON_MAX_DB_BITS;
+ ntb->limits.max_db_bits = XEON_MAX_DB_BITS;
ntb->limits.msix_cnt = XEON_MSIX_CNT;
ntb->bits_per_vector = XEON_DB_BITS_PER_VEC;
@@ -812,26 +812,26 @@ ntb_setup_soc(struct ntb_softc *ntb)
pci_write_config(ntb->device, NTB_PPD_OFFSET, val | SOC_PPD_INIT_LINK,
4);
- ntb->reg_ofs.pdb = SOC_PDOORBELL_OFFSET;
- ntb->reg_ofs.pdb_mask = SOC_PDBMSK_OFFSET;
- ntb->reg_ofs.sbar2_xlat = SOC_SBAR2XLAT_OFFSET;
- ntb->reg_ofs.sbar4_xlat = SOC_SBAR4XLAT_OFFSET;
+ ntb->reg_ofs.ldb = SOC_PDOORBELL_OFFSET;
+ ntb->reg_ofs.ldb_mask = SOC_PDBMSK_OFFSET;
+ ntb->reg_ofs.bar2_xlat = SOC_SBAR2XLAT_OFFSET;
+ ntb->reg_ofs.bar4_xlat = SOC_SBAR4XLAT_OFFSET;
ntb->reg_ofs.lnk_cntl = SOC_NTBCNTL_OFFSET;
ntb->reg_ofs.lnk_stat = SOC_LINK_STATUS_OFFSET;
ntb->reg_ofs.spad_local = SOC_SPAD_OFFSET;
ntb->reg_ofs.spci_cmd = SOC_PCICMD_OFFSET;
if (ntb->conn_type == NTB_CONN_B2B) {
- ntb->reg_ofs.sdb = SOC_B2B_DOORBELL_OFFSET;
+ ntb->reg_ofs.rdb = SOC_B2B_DOORBELL_OFFSET;
ntb->reg_ofs.spad_remote = SOC_B2B_SPAD_OFFSET;
ntb->limits.max_spads = SOC_MAX_SPADS;
} else {
- ntb->reg_ofs.sdb = SOC_PDOORBELL_OFFSET;
+ ntb->reg_ofs.rdb = SOC_PDOORBELL_OFFSET;
ntb->reg_ofs.spad_remote = SOC_SPAD_OFFSET;
ntb->limits.max_spads = SOC_MAX_COMPAT_SPADS;
}
- ntb->limits.max_db_bits = SOC_MAX_DB_BITS;
+ ntb->limits.max_db_bits = SOC_MAX_DB_BITS;
ntb->limits.msix_cnt = SOC_MSIX_CNT;
ntb->bits_per_vector = SOC_DB_BITS_PER_VEC;
@@ -1156,9 +1156,9 @@ ntb_register_db_callback(struct ntb_soft
ntb->db_cb[idx].data = data;
/* unmask interrupt */
- mask = ntb_reg_read(2, ntb->reg_ofs.pdb_mask);
+ mask = ntb_reg_read(2, ntb->reg_ofs.ldb_mask);
mask &= ~(1 << (idx * ntb->bits_per_vector));
- ntb_reg_write(2, ntb->reg_ofs.pdb_mask, mask);
+ ntb_reg_write(2, ntb->reg_ofs.ldb_mask, mask);
return (0);
}
@@ -1179,9 +1179,9 @@ ntb_unregister_db_callback(struct ntb_so
if (idx >= ntb->allocated_interrupts || !ntb->db_cb[idx].callback)
return;
- mask = ntb_reg_read(2, ntb->reg_ofs.pdb_mask);
+ mask = ntb_reg_read(2, ntb->reg_ofs.ldb_mask);
mask |= 1 << (idx * ntb->bits_per_vector);
- ntb_reg_write(2, ntb->reg_ofs.pdb_mask, mask);
+ ntb_reg_write(2, ntb->reg_ofs.ldb_mask, mask);
ntb->db_cb[idx].callback = NULL;
}
@@ -1430,16 +1430,16 @@ ntb_set_mw_addr(struct ntb_softc *ntb, u
switch (NTB_MW_TO_BAR(mw)) {
case NTB_B2B_BAR_1:
- ntb_reg_write(8, ntb->reg_ofs.sbar2_xlat, addr);
+ ntb_reg_write(8, ntb->reg_ofs.bar2_xlat, addr);
break;
case NTB_B2B_BAR_2:
- ntb_reg_write(8, ntb->reg_ofs.sbar4_xlat, addr);
+ ntb_reg_write(8, ntb->reg_ofs.bar4_xlat, addr);
break;
}
}
/**
- * ntb_ring_sdb() - Set the doorbell on the secondary/external side
+ * ntb_ring_doorbell() - Set the doorbell on the secondary/external side
* @ntb: pointer to ntb_softc instance
* @db: doorbell to ring
*
@@ -1449,18 +1449,18 @@ ntb_set_mw_addr(struct ntb_softc *ntb, u
* RETURNS: An appropriate ERRNO error value on error, or zero for success.
*/
void
-ntb_ring_sdb(struct ntb_softc *ntb, unsigned int db)
+ntb_ring_doorbell(struct ntb_softc *ntb, unsigned int db)
{
if (ntb->type == NTB_SOC)
- ntb_reg_write(8, ntb->reg_ofs.sdb, (uint64_t) 1 << db);
+ ntb_reg_write(8, ntb->reg_ofs.rdb, (uint64_t) 1 << db);
else {
if (HAS_FEATURE(NTB_REGS_THRU_MW))
ntb_mw_write(2, XEON_SHADOW_PDOORBELL_OFFSET,
((1 << ntb->bits_per_vector) - 1) <<
(db * ntb->bits_per_vector));
else
- ntb_reg_write(2, ntb->reg_ofs.sdb,
+ ntb_reg_write(2, ntb->reg_ofs.rdb,
((1 << ntb->bits_per_vector) - 1) <<
(db * ntb->bits_per_vector));
}
Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.h
==============================================================================
--- head/sys/dev/ntb/ntb_hw/ntb_hw.h Tue Oct 13 19:42:57 2015 (r289254)
+++ head/sys/dev/ntb/ntb_hw/ntb_hw.h Tue Oct 13 19:44:25 2015 (r289255)
@@ -69,7 +69,7 @@ void *ntb_get_mw_vbase(struct ntb_softc
vm_paddr_t ntb_get_mw_pbase(struct ntb_softc *ntb, unsigned int mw);
u_long ntb_get_mw_size(struct ntb_softc *ntb, unsigned int mw);
void ntb_set_mw_addr(struct ntb_softc *ntb, unsigned int mw, uint64_t addr);
-void ntb_ring_sdb(struct ntb_softc *ntb, unsigned int db);
+void ntb_ring_doorbell(struct ntb_softc *ntb, unsigned int db);
bool ntb_query_link_status(struct ntb_softc *ntb);
device_t ntb_get_device(struct ntb_softc *ntb);
More information about the svn-src-all
mailing list