Updated from Linux LTS 3.10.18 to 3.10.19
This commit is contained in:
@@ -78,6 +78,8 @@ enum {
|
||||
BWD_HW,
|
||||
};
|
||||
|
||||
static struct dentry *debugfs_dir;
|
||||
|
||||
/* Translate memory window 0,1 to BAR 2,4 */
|
||||
#define MW_TO_BAR(mw) (mw * 2 + 2)
|
||||
|
||||
@@ -531,9 +533,9 @@ static int ntb_xeon_setup(struct ntb_device *ndev)
|
||||
}
|
||||
|
||||
if (val & SNB_PPD_DEV_TYPE)
|
||||
ndev->dev_type = NTB_DEV_DSD;
|
||||
else
|
||||
ndev->dev_type = NTB_DEV_USD;
|
||||
else
|
||||
ndev->dev_type = NTB_DEV_DSD;
|
||||
|
||||
ndev->reg_ofs.pdb = ndev->reg_base + SNB_PDOORBELL_OFFSET;
|
||||
ndev->reg_ofs.pdb_mask = ndev->reg_base + SNB_PDBMSK_OFFSET;
|
||||
@@ -547,7 +549,7 @@ static int ntb_xeon_setup(struct ntb_device *ndev)
|
||||
if (ndev->conn_type == NTB_CONN_B2B) {
|
||||
ndev->reg_ofs.sdb = ndev->reg_base + SNB_B2B_DOORBELL_OFFSET;
|
||||
ndev->reg_ofs.spad_write = ndev->reg_base + SNB_B2B_SPAD_OFFSET;
|
||||
ndev->limits.max_spads = SNB_MAX_SPADS;
|
||||
ndev->limits.max_spads = SNB_MAX_B2B_SPADS;
|
||||
} else {
|
||||
ndev->reg_ofs.sdb = ndev->reg_base + SNB_SDOORBELL_OFFSET;
|
||||
ndev->reg_ofs.spad_write = ndev->reg_base + SNB_SPAD_OFFSET;
|
||||
@@ -644,10 +646,16 @@ static int ntb_device_setup(struct ntb_device *ndev)
|
||||
rc = -ENODEV;
|
||||
}
|
||||
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
dev_info(&ndev->pdev->dev, "Device Type = %s\n",
|
||||
ndev->dev_type == NTB_DEV_USD ? "USD/DSP" : "DSD/USP");
|
||||
|
||||
/* Enable Bus Master and Memory Space on the secondary side */
|
||||
writew(PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER, ndev->reg_ofs.spci_cmd);
|
||||
|
||||
return rc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ntb_device_free(struct ntb_device *ndev)
|
||||
@@ -992,6 +1000,28 @@ static void ntb_free_callbacks(struct ntb_device *ndev)
|
||||
kfree(ndev->db_cb);
|
||||
}
|
||||
|
||||
static void ntb_setup_debugfs(struct ntb_device *ndev)
|
||||
{
|
||||
if (!debugfs_initialized())
|
||||
return;
|
||||
|
||||
if (!debugfs_dir)
|
||||
debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
|
||||
|
||||
ndev->debugfs_dir = debugfs_create_dir(pci_name(ndev->pdev),
|
||||
debugfs_dir);
|
||||
}
|
||||
|
||||
static void ntb_free_debugfs(struct ntb_device *ndev)
|
||||
{
|
||||
debugfs_remove_recursive(ndev->debugfs_dir);
|
||||
|
||||
if (debugfs_dir && simple_empty(debugfs_dir)) {
|
||||
debugfs_remove_recursive(debugfs_dir);
|
||||
debugfs_dir = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int ntb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
{
|
||||
struct ntb_device *ndev;
|
||||
@@ -1004,6 +1034,7 @@ static int ntb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
ndev->pdev = pdev;
|
||||
ndev->link_status = NTB_LINK_DOWN;
|
||||
pci_set_drvdata(pdev, ndev);
|
||||
ntb_setup_debugfs(ndev);
|
||||
|
||||
rc = pci_enable_device(pdev);
|
||||
if (rc)
|
||||
@@ -1100,6 +1131,7 @@ err2:
|
||||
err1:
|
||||
pci_disable_device(pdev);
|
||||
err:
|
||||
ntb_free_debugfs(ndev);
|
||||
kfree(ndev);
|
||||
|
||||
dev_err(&pdev->dev, "Error loading %s module\n", KBUILD_MODNAME);
|
||||
@@ -1129,6 +1161,7 @@ static void ntb_pci_remove(struct pci_dev *pdev)
|
||||
iounmap(ndev->reg_base);
|
||||
pci_release_selected_regions(pdev, NTB_BAR_MASK);
|
||||
pci_disable_device(pdev);
|
||||
ntb_free_debugfs(ndev);
|
||||
kfree(ndev);
|
||||
}
|
||||
|
||||
|
||||
@@ -127,6 +127,8 @@ struct ntb_device {
|
||||
unsigned char link_status;
|
||||
struct delayed_work hb_timer;
|
||||
unsigned long last_ts;
|
||||
|
||||
struct dentry *debugfs_dir;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -155,6 +157,20 @@ static inline struct pci_dev *ntb_query_pdev(struct ntb_device *ndev)
|
||||
return ndev->pdev;
|
||||
}
|
||||
|
||||
/**
|
||||
* ntb_query_debugfs() - return the debugfs pointer
|
||||
* @ndev: pointer to ntb_device instance
|
||||
*
|
||||
* Given the ntb pointer, return the debugfs directory pointer for the NTB
|
||||
* hardware device
|
||||
*
|
||||
* RETURNS: a pointer to the debugfs directory
|
||||
*/
|
||||
static inline struct dentry *ntb_query_debugfs(struct ntb_device *ndev)
|
||||
{
|
||||
return ndev->debugfs_dir;
|
||||
}
|
||||
|
||||
struct ntb_device *ntb_register_transport(struct pci_dev *pdev,
|
||||
void *transport);
|
||||
void ntb_unregister_transport(struct ntb_device *ndev);
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
#define NTB_LINK_WIDTH_MASK 0x03f0
|
||||
|
||||
#define SNB_MSIX_CNT 4
|
||||
#define SNB_MAX_SPADS 16
|
||||
#define SNB_MAX_COMPAT_SPADS 8
|
||||
#define SNB_MAX_B2B_SPADS 16
|
||||
#define SNB_MAX_COMPAT_SPADS 16
|
||||
/* Reserve the uppermost bit for link interrupt */
|
||||
#define SNB_MAX_DB_BITS 15
|
||||
#define SNB_DB_BITS_PER_VEC 5
|
||||
|
||||
@@ -157,7 +157,6 @@ struct ntb_transport {
|
||||
bool transport_link;
|
||||
struct delayed_work link_work;
|
||||
struct work_struct link_cleanup;
|
||||
struct dentry *debugfs_dir;
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -824,12 +823,12 @@ static void ntb_transport_init_queue(struct ntb_transport *nt,
|
||||
qp->tx_max_frame = min(transport_mtu, tx_size / 2);
|
||||
qp->tx_max_entry = tx_size / qp->tx_max_frame;
|
||||
|
||||
if (nt->debugfs_dir) {
|
||||
if (ntb_query_debugfs(nt->ndev)) {
|
||||
char debugfs_name[4];
|
||||
|
||||
snprintf(debugfs_name, 4, "qp%d", qp_num);
|
||||
qp->debugfs_dir = debugfs_create_dir(debugfs_name,
|
||||
nt->debugfs_dir);
|
||||
ntb_query_debugfs(nt->ndev));
|
||||
|
||||
qp->debugfs_stats = debugfs_create_file("stats", S_IRUSR,
|
||||
qp->debugfs_dir, qp,
|
||||
@@ -857,11 +856,6 @@ int ntb_transport_init(struct pci_dev *pdev)
|
||||
if (!nt)
|
||||
return -ENOMEM;
|
||||
|
||||
if (debugfs_initialized())
|
||||
nt->debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
|
||||
else
|
||||
nt->debugfs_dir = NULL;
|
||||
|
||||
nt->ndev = ntb_register_transport(pdev, nt);
|
||||
if (!nt->ndev) {
|
||||
rc = -EIO;
|
||||
@@ -907,7 +901,6 @@ err2:
|
||||
err1:
|
||||
ntb_unregister_transport(nt->ndev);
|
||||
err:
|
||||
debugfs_remove_recursive(nt->debugfs_dir);
|
||||
kfree(nt);
|
||||
return rc;
|
||||
}
|
||||
@@ -921,16 +914,16 @@ void ntb_transport_free(void *transport)
|
||||
nt->transport_link = NTB_LINK_DOWN;
|
||||
|
||||
/* verify that all the qp's are freed */
|
||||
for (i = 0; i < nt->max_qps; i++)
|
||||
for (i = 0; i < nt->max_qps; i++) {
|
||||
if (!test_bit(i, &nt->qp_bitmap))
|
||||
ntb_transport_free_queue(&nt->qps[i]);
|
||||
debugfs_remove_recursive(nt->qps[i].debugfs_dir);
|
||||
}
|
||||
|
||||
ntb_bus_remove(nt);
|
||||
|
||||
cancel_delayed_work_sync(&nt->link_work);
|
||||
|
||||
debugfs_remove_recursive(nt->debugfs_dir);
|
||||
|
||||
ntb_unregister_event_callback(nt->ndev);
|
||||
|
||||
pdev = ntb_query_pdev(nt->ndev);
|
||||
|
||||
Reference in New Issue
Block a user