Link toggling fixes and debugfs error path fixes
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoE9b9c3U2JxX98mqbmZLrHqL0iMFAmTspXgACgkQbmZLrHqL 0iOD1hAAjQfLo8AmAKN0xWhr7+8HQjdSHgkqnOgeySDvWu40aWlSRRQ6bsuXoQ9G TGNX6Emqsgc6CcZ63x5yeerLMudaaSliRSDdcN3HUTmnnqSl/mDteBIsYRpsjpA8 hl7qZU377N8WRTglQjvta62jVp/o67EJxQGqhQiI4Yi9GY0KLB8Pn6ta8A0S2x5A C8RHUv7O7006Ox64uYP9Woes469oltPvkU2RiDnGoaZ3055SFkoylB1yflpK74JM fipTM6Y4ciiEbEJT8H1gIYd8qVEDHn4r7QLA2m9oZo1/uhDErVCKMS7sOmHvphfP aBXpPv5H4f9wQ6MXuFlZWFmbQXzVdYcL6eje24rcYNSGNLbjl92FqmZoH8wU5MUB JXuQdJ6+eDMyue78n9XOurBbTVUSq+KIeSpWktheBujNiBEgQ08O4Nr8TBJsPttR vcBqX+QcK0ivTgtWRojVyd3rlJcyHFbhaOk4x+5Og1VlLyi+dkfbcOiKpaMTZyIs cw7aLhK4mlUfL26U/bPLSFo7PmWaNO/UaialtykqG+9mELW2WiobBKEHCXUw7xs2 TuFkRDv42w3DpKPm2cr93wbxbcoBFpOZMcX1CgYKBOGVon2UZDs26Jtvm8yj//Px nkqDRwYWFVJVF/3RIq0dGW24GbNH7Y5IK4OEqr+Cd71U7lyTjMA= =rOGo -----END PGP SIGNATURE----- Merge tag 'ntb-6.6' of https://github.com/jonmason/ntb Pull NTB updates from Jon Mason: "Link toggling fixes and debugfs error path fixes" [ And for everybody like me who always have to remind themselves what the TLA of the day is, and what NTB stands for - it's a PCIe "Non-Transparent Bridge" thing - Linus ] * tag 'ntb-6.6' of https://github.com/jonmason/ntb: ntb: Check tx descriptors outstanding instead of head/tail for tx queue ntb: Fix calculation ntb_transport_tx_free_entry() ntb: Drop packets when qp link is down ntb: Clean up tx tail index on link down ntb: amd: Drop unnecessary error check for debugfs_create_dir NTB: ntb_tool: Switch to memdup_user_nul() helper dtivers: ntb: fix parameter check in perf_setup_dbgfs() ntb: Remove error checking for debugfs_create_dir()
This commit is contained in:
commit
fa9d4bf5b7
@ -941,13 +941,10 @@ static void ndev_init_debugfs(struct amd_ntb_dev *ndev)
|
||||
ndev->debugfs_dir =
|
||||
debugfs_create_dir(pci_name(ndev->ntb.pdev),
|
||||
debugfs_dir);
|
||||
if (IS_ERR(ndev->debugfs_dir))
|
||||
ndev->debugfs_info = NULL;
|
||||
else
|
||||
ndev->debugfs_info =
|
||||
debugfs_create_file("info", S_IRUSR,
|
||||
ndev->debugfs_dir, ndev,
|
||||
&amd_ntb_debugfs_info);
|
||||
ndev->debugfs_info =
|
||||
debugfs_create_file("info", S_IRUSR,
|
||||
ndev->debugfs_dir, ndev,
|
||||
&amd_ntb_debugfs_info);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -909,7 +909,7 @@ static int ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ntb_qp_link_down_reset(struct ntb_transport_qp *qp)
|
||||
static void ntb_qp_link_context_reset(struct ntb_transport_qp *qp)
|
||||
{
|
||||
qp->link_is_up = false;
|
||||
qp->active = false;
|
||||
@ -932,6 +932,13 @@ static void ntb_qp_link_down_reset(struct ntb_transport_qp *qp)
|
||||
qp->tx_async = 0;
|
||||
}
|
||||
|
||||
static void ntb_qp_link_down_reset(struct ntb_transport_qp *qp)
|
||||
{
|
||||
ntb_qp_link_context_reset(qp);
|
||||
if (qp->remote_rx_info)
|
||||
qp->remote_rx_info->entry = qp->rx_max_entry - 1;
|
||||
}
|
||||
|
||||
static void ntb_qp_link_cleanup(struct ntb_transport_qp *qp)
|
||||
{
|
||||
struct ntb_transport_ctx *nt = qp->transport;
|
||||
@ -1174,7 +1181,7 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt,
|
||||
qp->ndev = nt->ndev;
|
||||
qp->client_ready = false;
|
||||
qp->event_handler = NULL;
|
||||
ntb_qp_link_down_reset(qp);
|
||||
ntb_qp_link_context_reset(qp);
|
||||
|
||||
if (mw_num < qp_count % mw_count)
|
||||
num_qps_mw = qp_count / mw_count + 1;
|
||||
@ -1894,7 +1901,7 @@ err:
|
||||
static int ntb_process_tx(struct ntb_transport_qp *qp,
|
||||
struct ntb_queue_entry *entry)
|
||||
{
|
||||
if (qp->tx_index == qp->remote_rx_info->entry) {
|
||||
if (!ntb_transport_tx_free_entry(qp)) {
|
||||
qp->tx_ring_full++;
|
||||
return -EAGAIN;
|
||||
}
|
||||
@ -2276,9 +2283,13 @@ int ntb_transport_tx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data,
|
||||
struct ntb_queue_entry *entry;
|
||||
int rc;
|
||||
|
||||
if (!qp || !qp->link_is_up || !len)
|
||||
if (!qp || !len)
|
||||
return -EINVAL;
|
||||
|
||||
/* If the qp link is down already, just ignore. */
|
||||
if (!qp->link_is_up)
|
||||
return 0;
|
||||
|
||||
entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q);
|
||||
if (!entry) {
|
||||
qp->tx_err_no_buf++;
|
||||
@ -2418,7 +2429,7 @@ unsigned int ntb_transport_tx_free_entry(struct ntb_transport_qp *qp)
|
||||
unsigned int head = qp->tx_index;
|
||||
unsigned int tail = qp->remote_rx_info->entry;
|
||||
|
||||
return tail > head ? tail - head : qp->tx_max_entry + tail - head;
|
||||
return tail >= head ? tail - head : qp->tx_max_entry + tail - head;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ntb_transport_tx_free_entry);
|
||||
|
||||
|
@ -1355,7 +1355,7 @@ static void perf_setup_dbgfs(struct perf_ctx *perf)
|
||||
struct pci_dev *pdev = perf->ntb->pdev;
|
||||
|
||||
perf->dbgfs_dir = debugfs_create_dir(pci_name(pdev), perf_dbgfs_topdir);
|
||||
if (!perf->dbgfs_dir) {
|
||||
if (IS_ERR(perf->dbgfs_dir)) {
|
||||
dev_warn(&perf->ntb->dev, "DebugFS unsupported\n");
|
||||
return;
|
||||
}
|
||||
|
@ -370,16 +370,9 @@ static ssize_t tool_fn_write(struct tool_ctx *tc,
|
||||
if (*offp)
|
||||
return 0;
|
||||
|
||||
buf = kmalloc(size + 1, GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
if (copy_from_user(buf, ubuf, size)) {
|
||||
kfree(buf);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
buf[size] = 0;
|
||||
buf = memdup_user_nul(ubuf, size);
|
||||
if (IS_ERR(buf))
|
||||
return PTR_ERR(buf);
|
||||
|
||||
n = sscanf(buf, "%c %lli", &cmd, &bits);
|
||||
|
||||
@ -1495,8 +1488,6 @@ static void tool_setup_dbgfs(struct tool_ctx *tc)
|
||||
|
||||
tc->dbgfs_dir = debugfs_create_dir(dev_name(&tc->ntb->dev),
|
||||
tool_dbgfs_topdir);
|
||||
if (!tc->dbgfs_dir)
|
||||
return;
|
||||
|
||||
debugfs_create_file("port", 0600, tc->dbgfs_dir,
|
||||
tc, &tool_port_fops);
|
||||
|
Loading…
x
Reference in New Issue
Block a user