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

NFC: Stop sending LLCP frames when tx queues are getting too deep

When the tx pending queues and/or the socket tx queue is getting too deep,
we have to let userspace know. We won't be queueing any more frames until
the congestion is fixed.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

+17
+17
net/nfc/llcp/commands.c
··· 528 528 if (local == NULL) 529 529 return -ENODEV; 530 530 531 + /* Remote is ready but has not acknowledged our frames */ 532 + if((sock->remote_ready && 533 + skb_queue_len(&sock->tx_pending_queue) >= sock->rw && 534 + skb_queue_len(&sock->tx_queue) >= 2 * sock->rw)) { 535 + pr_err("Pending queue is full %d frames\n", 536 + skb_queue_len(&sock->tx_pending_queue)); 537 + return -ENOBUFS; 538 + } 539 + 540 + /* Remote is not ready and we've been queueing enough frames */ 541 + if ((!sock->remote_ready && 542 + skb_queue_len(&sock->tx_queue) >= 2 * sock->rw)) { 543 + pr_err("Tx queue is full %d frames\n", 544 + skb_queue_len(&sock->tx_queue)); 545 + return -ENOBUFS; 546 + } 547 + 531 548 msg_data = kzalloc(len, GFP_KERNEL); 532 549 if (msg_data == NULL) 533 550 return -ENOMEM;