From patchwork Sun Feb 18 16:08:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Falcon X-Patchwork-Id: 874885 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zksJ83MPXz9sWy for ; Mon, 19 Feb 2018 03:08:56 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751455AbeBRQIx (ORCPT ); Sun, 18 Feb 2018 11:08:53 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49652 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751297AbeBRQIv (ORCPT ); Sun, 18 Feb 2018 11:08:51 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1IG6caT010321 for ; Sun, 18 Feb 2018 11:08:50 -0500 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx0a-001b2d01.pphosted.com with ESMTP id 2g72afpbd4-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sun, 18 Feb 2018 11:08:50 -0500 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 18 Feb 2018 09:08:49 -0700 Received: from b03cxnp08028.gho.boulder.ibm.com (9.17.130.20) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 18 Feb 2018 09:08:48 -0700 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1IG8kQ312714422; Sun, 18 Feb 2018 09:08:46 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF3756E045; Sun, 18 Feb 2018 09:08:46 -0700 (MST) Received: from tlfalcon-workstation.attlocal.net (unknown [9.80.200.43]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP id 230466E03F; Sun, 18 Feb 2018 09:08:45 -0700 (MST) From: Thomas Falcon To: netdev@vger.kernel.org Cc: nfont@linux.vnet.ibm.com, jallen@linux.vnet.ibm.com, Thomas Falcon Subject: [PATCH net-next] ibmvnic: Keep track of supplementary TX descriptors Date: Sun, 18 Feb 2018 10:08:41 -0600 X-Mailer: git-send-email 2.7.5 In-Reply-To: <1518970121-8539-1-git-send-email-tlfalcon@linux.vnet.ibm.com> References: <1518970121-8539-1-git-send-email-tlfalcon@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18021816-8235-0000-0000-00000D09BABF X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008555; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.00991581; UDB=6.00503681; IPR=6.00770927; MB=3.00019622; MTD=3.00000008; XFM=3.00000015; UTC=2018-02-18 16:08:49 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18021816-8236-0000-0000-00003FBB3267 Message-Id: <1518970121-8539-2-git-send-email-tlfalcon@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-02-18_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802180217 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Supplementary TX descriptors were not being accounted for, which was resulting in an overflow of the hardware device's transmit queue. Keep track of those descriptors now when determining how many entries remain on the TX queue. Signed-off-by: Thomas Falcon --- drivers/net/ethernet/ibm/ibmvnic.c | 8 ++++++-- drivers/net/ethernet/ibm/ibmvnic.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index a3865ff5a48e..7f5488695fd5 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -1469,6 +1469,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) if ((*hdrs >> 7) & 1) { build_hdr_descs_arr(tx_buff, &num_entries, *hdrs); tx_crq.v1.n_crq_elem = num_entries; + tx_buff->num_entries = num_entries; tx_buff->indir_arr[0] = tx_crq; tx_buff->indir_dma = dma_map_single(dev, tx_buff->indir_arr, sizeof(tx_buff->indir_arr), @@ -1517,7 +1518,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) goto out; } - if (atomic_inc_return(&tx_scrq->used) + if (atomic_add_return(num_entries, &tx_scrq->used) >= adapter->req_tx_entries_per_subcrq) { netdev_info(netdev, "Stopping queue %d\n", queue_num); netif_stop_subqueue(netdev, queue_num); @@ -2470,6 +2471,7 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter, restart_loop: while (pending_scrq(adapter, scrq)) { unsigned int pool = scrq->pool_index; + int num_entries = 0; next = ibmvnic_next_scrq(adapter, scrq); for (i = 0; i < next->tx_comp.num_comps; i++) { @@ -2500,6 +2502,8 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter, txbuff->skb = NULL; } + num_entries += txbuff->num_entries; + adapter->tx_pool[pool].free_map[adapter->tx_pool[pool]. producer_index] = index; adapter->tx_pool[pool].producer_index = @@ -2509,7 +2513,7 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter, /* remove tx_comp scrq*/ next->tx_comp.first = 0; - if (atomic_sub_return(next->tx_comp.num_comps, &scrq->used) <= + if (atomic_sub_return(num_entries, &scrq->used) <= (adapter->req_tx_entries_per_subcrq / 2) && __netif_subqueue_stopped(adapter->netdev, scrq->pool_index)) { diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h index fe21a6e2ddae..2f51458ccdc3 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.h +++ b/drivers/net/ethernet/ibm/ibmvnic.h @@ -909,6 +909,7 @@ struct ibmvnic_tx_buff { union sub_crq indir_arr[6]; u8 hdr_data[140]; dma_addr_t indir_dma; + int num_entries; }; struct ibmvnic_tx_pool {