netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Allen <jallen@linux.vnet.ibm.com>
To: netdev@vger.kernel.org
Cc: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>,
	Nathan Fontenot <nfont@linux.vnet.ibm.com>,
	desnesn@linux.vnet.ibm.com
Subject: [PATCH 1/3 net] ibmvnic: Modify buffer size on failover
Date: Mon, 15 Jan 2018 15:11:55 -0600	[thread overview]
Message-ID: <a9c6a30d-3ce6-df6e-0b89-f4a0b480624e@linux.vnet.ibm.com> (raw)
In-Reply-To: <2154f098-7c1a-5db2-cc30-6172e3019a8f@linux.vnet.ibm.com>

Using newer backing devices can cause the required padding at the end of
rx buffers to change. Currently we assume that the size of buffers will
never change, but in the case that we failover from a backing device with
smaller padding requirement to a backing device with a larger padding
requirement, the vnic server will fail to post rx buffers due to
inadequate space in our rx pool. This patch fixes the issue by checking
whether or not the buffer size has changed on a reset and if it has,
reallocate the buffer.

Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
---
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index b676fa9..5b68a28 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -412,13 +412,25 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter)
 	int rx_scrqs;
 	int i, j, rc;

+	size_array = (u64 *)((u8 *)(adapter->login_rsp_buf) +
+		be32_to_cpu(adapter->login_rsp_buf->off_rxadd_buff_size));
+
 	rx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_rxadd_subcrqs);
 	for (i = 0; i < rx_scrqs; i++) {
 		rx_pool = &adapter->rx_pool[i];

 		netdev_dbg(adapter->netdev, "Re-setting rx_pool[%d]\n", i);

-		rc = reset_long_term_buff(adapter, &rx_pool->long_term_buff);
+		if (rx_pool->buff_size != be64_to_cpu(size_array[i])) {
+			rx_pool->buff_size = be64_to_cpu(size_array[i]);
+			rc = alloc_long_term_buff(adapter,
+						  &rx_pool->long_term_buff,
+						  rx_pool->size *
+						  rx_pool->buff_size);
+		} else {
+			rc = reset_long_term_buff(adapter,
+						  &rx_pool->long_term_buff);
+		}
 		if (rc)
 			return rc;

  reply	other threads:[~2018-01-15 21:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-15 21:09 [PATCH 0/3 net] ibmvnic: Reset behavior fixes John Allen
2018-01-15 21:11 ` John Allen [this message]
2018-01-15 21:49   ` [PATCH 1/3 net] ibmvnic: Modify buffer size on failover John Allen
2018-01-18 12:18   ` kbuild test robot
2018-01-15 21:12 ` [PATCH 2/3 net] ibmvnic: Revert to previous mtu when unsupported value requested John Allen
2018-01-15 21:13 ` [PATCH 3/3 net] ibmvnic: Allocate and request vpd in init_resources John Allen

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=a9c6a30d-3ce6-df6e-0b89-f4a0b480624e@linux.vnet.ibm.com \
    --to=jallen@linux.vnet.ibm.com \
    --cc=desnesn@linux.vnet.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=nfont@linux.vnet.ibm.com \
    --cc=tlfalcon@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).