From: Thomas Falcon <tlfalcon@linux.ibm.com>
To: kuba@kernel.org
Cc: cforno12@linux.ibm.com, netdev@vger.kernel.org,
ljp@linux.vnet.ibm.com, ricklind@linux.ibm.com,
dnbanerg@us.ibm.com, tlfalcon@linux.ibm.com,
drt@linux.vnet.ibm.com, brking@linux.vnet.ibm.com,
sukadev@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH net-next v2 1/9] ibmvnic: Introduce indirect subordinate Command Response Queue buffer
Date: Wed, 18 Nov 2020 19:12:17 -0600 [thread overview]
Message-ID: <1605748345-32062-2-git-send-email-tlfalcon@linux.ibm.com> (raw)
In-Reply-To: <1605748345-32062-1-git-send-email-tlfalcon@linux.ibm.com>
This patch introduces the infrastructure to send batched subordinate
Command Response Queue descriptors, which are used by the ibmvnic
driver to send TX frame and RX buffer descriptors.
Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 23 +++++++++++++++++++++++
drivers/net/ethernet/ibm/ibmvnic.h | 9 +++++++++
2 files changed, 32 insertions(+)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index da15913879f8..3884f8a683a7 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -2858,6 +2858,7 @@ static int reset_one_sub_crq_queue(struct ibmvnic_adapter *adapter,
memset(scrq->msgs, 0, 4 * PAGE_SIZE);
atomic_set(&scrq->used, 0);
scrq->cur = 0;
+ scrq->ind_buf.index = 0;
rc = h_reg_sub_crq(adapter->vdev->unit_address, scrq->msg_token,
4 * PAGE_SIZE, &scrq->crq_num, &scrq->hw_irq);
@@ -2909,6 +2910,11 @@ static void release_sub_crq_queue(struct ibmvnic_adapter *adapter,
}
}
+ dma_free_coherent(dev,
+ IBMVNIC_IND_ARR_SZ,
+ scrq->ind_buf.indir_arr,
+ scrq->ind_buf.indir_dma);
+
dma_unmap_single(dev, scrq->msg_token, 4 * PAGE_SIZE,
DMA_BIDIRECTIONAL);
free_pages((unsigned long)scrq->msgs, 2);
@@ -2955,6 +2961,17 @@ static struct ibmvnic_sub_crq_queue *init_sub_crq_queue(struct ibmvnic_adapter
scrq->adapter = adapter;
scrq->size = 4 * PAGE_SIZE / sizeof(*scrq->msgs);
+ scrq->ind_buf.index = 0;
+
+ scrq->ind_buf.indir_arr =
+ dma_alloc_coherent(dev,
+ IBMVNIC_IND_ARR_SZ,
+ &scrq->ind_buf.indir_dma,
+ GFP_KERNEL);
+
+ if (!scrq->ind_buf.indir_arr)
+ goto indir_failed;
+
spin_lock_init(&scrq->lock);
netdev_dbg(adapter->netdev,
@@ -2963,6 +2980,12 @@ static struct ibmvnic_sub_crq_queue *init_sub_crq_queue(struct ibmvnic_adapter
return scrq;
+indir_failed:
+ do {
+ rc = plpar_hcall_norets(H_FREE_SUB_CRQ,
+ adapter->vdev->unit_address,
+ scrq->crq_num);
+ } while (rc == H_BUSY || rc == H_IS_LONG_BUSY(rc));
reg_failed:
dma_unmap_single(dev, scrq->msg_token, 4 * PAGE_SIZE,
DMA_BIDIRECTIONAL);
diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
index 217dcc7ded70..4a63e9886719 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.h
+++ b/drivers/net/ethernet/ibm/ibmvnic.h
@@ -31,6 +31,8 @@
#define IBMVNIC_BUFFS_PER_POOL 100
#define IBMVNIC_MAX_QUEUES 16
#define IBMVNIC_MAX_QUEUE_SZ 4096
+#define IBMVNIC_MAX_IND_DESCS 128
+#define IBMVNIC_IND_ARR_SZ (IBMVNIC_MAX_IND_DESCS * 32)
#define IBMVNIC_TSO_BUF_SZ 65536
#define IBMVNIC_TSO_BUFS 64
@@ -861,6 +863,12 @@ union sub_crq {
struct ibmvnic_rx_buff_add_desc rx_add;
};
+struct ibmvnic_ind_xmit_queue {
+ union sub_crq *indir_arr;
+ dma_addr_t indir_dma;
+ int index;
+};
+
struct ibmvnic_sub_crq_queue {
union sub_crq *msgs;
int size, cur;
@@ -873,6 +881,7 @@ struct ibmvnic_sub_crq_queue {
spinlock_t lock;
struct sk_buff *rx_skb_top;
struct ibmvnic_adapter *adapter;
+ struct ibmvnic_ind_xmit_queue ind_buf;
atomic_t used;
char name[32];
u64 handle;
--
2.26.2
next prev parent reply other threads:[~2020-11-19 1:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-19 1:12 [PATCH net-next v2 0/9] ibmvnic: Performance improvements and other updates Thomas Falcon
2020-11-19 1:12 ` Thomas Falcon [this message]
2020-11-19 9:34 ` [PATCH net-next v2 1/9] ibmvnic: Introduce indirect subordinate Command Response Queue buffer ljp
2020-11-19 1:12 ` [PATCH net-next v2 2/9] ibmvnic: Introduce batched RX buffer descriptor transmission Thomas Falcon
2020-11-19 1:12 ` [PATCH net-next v2 3/9] ibmvnic: Introduce xmit_more support using batched subCRQ hcalls Thomas Falcon
2020-11-19 1:12 ` [PATCH net-next v2 4/9] ibmvnic: Clean up TX code and TX buffer data structure Thomas Falcon
2020-11-19 1:12 ` [PATCH net-next v2 5/9] ibmvnic: Remove send_subcrq function Thomas Falcon
2020-11-19 9:37 ` ljp
2020-11-19 1:12 ` [PATCH net-next v2 6/9] ibmvnic: Ensure that device queue memory is cache-line aligned Thomas Falcon
2020-11-19 1:12 ` [PATCH net-next v2 7/9] ibmvnic: Correctly re-enable interrupts in NAPI polling routine Thomas Falcon
2020-11-19 1:12 ` [PATCH net-next v2 8/9] ibmvnic: Use netdev_alloc_skb instead of alloc_skb to replenish RX buffers Thomas Falcon
2020-11-19 9:47 ` ljp
2020-11-19 1:12 ` [PATCH net-next v2 9/9] ibmvnic: Do not replenish RX buffers after every polling loop Thomas Falcon
2020-11-19 9:43 ` ljp
2020-11-19 20:26 ` Thomas Falcon
2020-11-19 20:38 ` ljp
2020-11-19 20:58 ` Thomas Falcon
2020-11-21 3:52 ` [PATCH net-next v2 0/9] ibmvnic: Performance improvements and other updates Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1605748345-32062-2-git-send-email-tlfalcon@linux.ibm.com \
--to=tlfalcon@linux.ibm.com \
--cc=brking@linux.vnet.ibm.com \
--cc=cforno12@linux.ibm.com \
--cc=dnbanerg@us.ibm.com \
--cc=drt@linux.vnet.ibm.com \
--cc=kuba@kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ljp@linux.vnet.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=ricklind@linux.ibm.com \
--cc=sukadev@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).