Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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()

+24 -25
+4 -7
drivers/ntb/hw/amd/ntb_hw_amd.c
··· 941 941 ndev->debugfs_dir = 942 942 debugfs_create_dir(pci_name(ndev->ntb.pdev), 943 943 debugfs_dir); 944 - if (IS_ERR(ndev->debugfs_dir)) 945 - ndev->debugfs_info = NULL; 946 - else 947 - ndev->debugfs_info = 948 - debugfs_create_file("info", S_IRUSR, 949 - ndev->debugfs_dir, ndev, 950 - &amd_ntb_debugfs_info); 944 + ndev->debugfs_info = 945 + debugfs_create_file("info", S_IRUSR, 946 + ndev->debugfs_dir, ndev, 947 + &amd_ntb_debugfs_info); 951 948 } 952 949 } 953 950
+16 -5
drivers/ntb/ntb_transport.c
··· 909 909 return 0; 910 910 } 911 911 912 - static void ntb_qp_link_down_reset(struct ntb_transport_qp *qp) 912 + static void ntb_qp_link_context_reset(struct ntb_transport_qp *qp) 913 913 { 914 914 qp->link_is_up = false; 915 915 qp->active = false; ··· 930 930 qp->tx_err_no_buf = 0; 931 931 qp->tx_memcpy = 0; 932 932 qp->tx_async = 0; 933 + } 934 + 935 + static void ntb_qp_link_down_reset(struct ntb_transport_qp *qp) 936 + { 937 + ntb_qp_link_context_reset(qp); 938 + if (qp->remote_rx_info) 939 + qp->remote_rx_info->entry = qp->rx_max_entry - 1; 933 940 } 934 941 935 942 static void ntb_qp_link_cleanup(struct ntb_transport_qp *qp) ··· 1181 1174 qp->ndev = nt->ndev; 1182 1175 qp->client_ready = false; 1183 1176 qp->event_handler = NULL; 1184 - ntb_qp_link_down_reset(qp); 1177 + ntb_qp_link_context_reset(qp); 1185 1178 1186 1179 if (mw_num < qp_count % mw_count) 1187 1180 num_qps_mw = qp_count / mw_count + 1; ··· 1901 1894 static int ntb_process_tx(struct ntb_transport_qp *qp, 1902 1895 struct ntb_queue_entry *entry) 1903 1896 { 1904 - if (qp->tx_index == qp->remote_rx_info->entry) { 1897 + if (!ntb_transport_tx_free_entry(qp)) { 1905 1898 qp->tx_ring_full++; 1906 1899 return -EAGAIN; 1907 1900 } ··· 2283 2276 struct ntb_queue_entry *entry; 2284 2277 int rc; 2285 2278 2286 - if (!qp || !qp->link_is_up || !len) 2279 + if (!qp || !len) 2287 2280 return -EINVAL; 2281 + 2282 + /* If the qp link is down already, just ignore. */ 2283 + if (!qp->link_is_up) 2284 + return 0; 2288 2285 2289 2286 entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q); 2290 2287 if (!entry) { ··· 2429 2418 unsigned int head = qp->tx_index; 2430 2419 unsigned int tail = qp->remote_rx_info->entry; 2431 2420 2432 - return tail > head ? tail - head : qp->tx_max_entry + tail - head; 2421 + return tail >= head ? tail - head : qp->tx_max_entry + tail - head; 2433 2422 } 2434 2423 EXPORT_SYMBOL_GPL(ntb_transport_tx_free_entry); 2435 2424
+1 -1
drivers/ntb/test/ntb_perf.c
··· 1355 1355 struct pci_dev *pdev = perf->ntb->pdev; 1356 1356 1357 1357 perf->dbgfs_dir = debugfs_create_dir(pci_name(pdev), perf_dbgfs_topdir); 1358 - if (!perf->dbgfs_dir) { 1358 + if (IS_ERR(perf->dbgfs_dir)) { 1359 1359 dev_warn(&perf->ntb->dev, "DebugFS unsupported\n"); 1360 1360 return; 1361 1361 }
+3 -12
drivers/ntb/test/ntb_tool.c
··· 370 370 if (*offp) 371 371 return 0; 372 372 373 - buf = kmalloc(size + 1, GFP_KERNEL); 374 - if (!buf) 375 - return -ENOMEM; 376 - 377 - if (copy_from_user(buf, ubuf, size)) { 378 - kfree(buf); 379 - return -EFAULT; 380 - } 381 - 382 - buf[size] = 0; 373 + buf = memdup_user_nul(ubuf, size); 374 + if (IS_ERR(buf)) 375 + return PTR_ERR(buf); 383 376 384 377 n = sscanf(buf, "%c %lli", &cmd, &bits); 385 378 ··· 1488 1495 1489 1496 tc->dbgfs_dir = debugfs_create_dir(dev_name(&tc->ntb->dev), 1490 1497 tool_dbgfs_topdir); 1491 - if (!tc->dbgfs_dir) 1492 - return; 1493 1498 1494 1499 debugfs_create_file("port", 0600, tc->dbgfs_dir, 1495 1500 tc, &tool_port_fops);