* [PATCH net v2 0/3] ibmvnic: Reset behavior fixes
@ 2018-01-18 22:25 John Allen
2018-01-18 22:26 ` [PATCH net v2 1/3] ibmvnic: Modify buffer size and number of queues on failover John Allen
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: John Allen @ 2018-01-18 22:25 UTC (permalink / raw)
To: netdev; +Cc: Thomas Falcon, Nathan Fontenot
This patchset fixes a number of issues related to ibmvnic reset uncovered
from testing new Power9 machines with Everglades adapters and the new
functionality to change mtu and other parameters in the driver.
Changes since v1:
-In patch 1/3, added the line to free the long term buffers before
allocating a new one. This change inadvertently uncovered the problem
that the number of queues can change after a failover as well. To fix
this, we check whether or not the number of queues has changed in
do_reset and if they have, we do a full release and init of the queues.
-In patch 1/3, added variables to the adapter struct to track how
many rx/tx pools have actually been allocated and modify the release
pools routines to use these values rather than the possibly incorrect
req_rx/tx_queues values.
John Allen (3):
ibmvnic: Modify buffer size and number of queues on failover
ibmvnic: Revert to previous mtu when unsupported value requested
ibmvnic: Allocate and request vpd in init_resources
drivers/net/ethernet/ibm/ibmvnic.c | 73 ++++++++++++++++++++++++++++++--------
drivers/net/ethernet/ibm/ibmvnic.h | 2 ++
2 files changed, 60 insertions(+), 15 deletions(-)
--
2.9.5
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net v2 1/3] ibmvnic: Modify buffer size and number of queues on failover
2018-01-18 22:25 [PATCH net v2 0/3] ibmvnic: Reset behavior fixes John Allen
@ 2018-01-18 22:26 ` John Allen
2018-01-19 19:22 ` Nathan Fontenot
2018-01-18 22:27 ` [PATCH net v2 2/3] ibmvnic: Revert to previous mtu when unsupported value requested John Allen
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: John Allen @ 2018-01-18 22:26 UTC (permalink / raw)
To: netdev; +Cc: Thomas Falcon, Nathan Fontenot
Using newer backing devices can cause the required padding at the end of
buffer as well as the number of queues to change after a failover.
Since we currently assume that these values never change, after a
failover to a backing device with different capabilities, we can get
errors from the vnic server, attempt to free long term buffers that are
no longer there, or not free long term buffers that should be freed.
This patch resolves the issue by checking whether any of these values
change, and if so perform the necessary re-allocations.
Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
---
v2: Added the line to free the long term buff in reset rx pools which
caused me to hit a couple of other problems. On a failover, the number
of queues can also change which doesn't get updated in the current
reset code. Added some extra logic in do reset to check for changed
number of queues and added some logic to release pools to ensure that
it is only releasing pools that were allocated in the init pools
routines.
---
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 461014b7ccdd..12559c63c226 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -411,6 +411,10 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter)
struct ibmvnic_rx_pool *rx_pool;
int rx_scrqs;
int i, j, rc;
+ u64 *size_array;
+
+ 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++) {
@@ -418,7 +422,17 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter)
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])) {
+ free_long_term_buff(adapter, &rx_pool->long_term_buff);
+ rx_pool->buff_size = be64_to_cpu(size_array[i]);
+ 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;
@@ -440,14 +454,12 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter)
static void release_rx_pools(struct ibmvnic_adapter *adapter)
{
struct ibmvnic_rx_pool *rx_pool;
- int rx_scrqs;
int i, j;
if (!adapter->rx_pool)
return;
- rx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_rxadd_subcrqs);
- for (i = 0; i < rx_scrqs; i++) {
+ for (i = 0; i < adapter->num_active_rx_pools; i++) {
rx_pool = &adapter->rx_pool[i];
netdev_dbg(adapter->netdev, "Releasing rx_pool[%d]\n", i);
@@ -470,6 +482,7 @@ static void release_rx_pools(struct ibmvnic_adapter *adapter)
kfree(adapter->rx_pool);
adapter->rx_pool = NULL;
+ adapter->num_active_rx_pools = 0;
}
static int init_rx_pools(struct net_device *netdev)
@@ -494,6 +507,8 @@ static int init_rx_pools(struct net_device *netdev)
return -1;
}
+ adapter->num_active_rx_pools = 0;
+
for (i = 0; i < rxadd_subcrqs; i++) {
rx_pool = &adapter->rx_pool[i];
@@ -537,6 +552,8 @@ static int init_rx_pools(struct net_device *netdev)
rx_pool->next_free = 0;
}
+ adapter->num_active_rx_pools = rxadd_subcrqs;
+
return 0;
}
@@ -587,13 +604,12 @@ static void release_vpd_data(struct ibmvnic_adapter *adapter)
static void release_tx_pools(struct ibmvnic_adapter *adapter)
{
struct ibmvnic_tx_pool *tx_pool;
- int i, tx_scrqs;
+ int i;
if (!adapter->tx_pool)
return;
- tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs);
- for (i = 0; i < tx_scrqs; i++) {
+ for (i = 0; i < adapter->num_active_tx_pools; i++) {
netdev_dbg(adapter->netdev, "Releasing tx_pool[%d]\n", i);
tx_pool = &adapter->tx_pool[i];
kfree(tx_pool->tx_buff);
@@ -604,6 +620,7 @@ static void release_tx_pools(struct ibmvnic_adapter *adapter)
kfree(adapter->tx_pool);
adapter->tx_pool = NULL;
+ adapter->num_active_tx_pools = 0;
}
static int init_tx_pools(struct net_device *netdev)
@@ -620,6 +637,8 @@ static int init_tx_pools(struct net_device *netdev)
if (!adapter->tx_pool)
return -1;
+ adapter->num_active_tx_pools = 0;
+
for (i = 0; i < tx_subcrqs; i++) {
tx_pool = &adapter->tx_pool[i];
@@ -667,6 +686,8 @@ static int init_tx_pools(struct net_device *netdev)
tx_pool->producer_index = 0;
}
+ adapter->num_active_tx_pools = tx_subcrqs;
+
return 0;
}
@@ -1550,6 +1571,7 @@ static int ibmvnic_set_mac(struct net_device *netdev, void *p)
static int do_reset(struct ibmvnic_adapter *adapter,
struct ibmvnic_rwi *rwi, u32 reset_state)
{
+ u64 old_num_rx_queues, old_num_tx_queues;
struct net_device *netdev = adapter->netdev;
int i, rc;
@@ -1559,6 +1581,9 @@ static int do_reset(struct ibmvnic_adapter *adapter,
netif_carrier_off(netdev);
adapter->reset_reason = rwi->reset_reason;
+ old_num_rx_queues = adapter->req_rx_queues;
+ old_num_tx_queues = adapter->req_tx_queues;
+
if (rwi->reset_reason == VNIC_RESET_MOBILITY) {
rc = ibmvnic_reenable_crq_queue(adapter);
if (rc)
@@ -1603,6 +1628,12 @@ static int do_reset(struct ibmvnic_adapter *adapter,
rc = init_resources(adapter);
if (rc)
return rc;
+ } else if (adapter->req_rx_queues != old_num_rx_queues ||
+ adapter->req_tx_queues != old_num_tx_queues) {
+ release_rx_pools(adapter);
+ release_tx_pools(adapter);
+ init_rx_pools(netdev);
+ init_tx_pools(netdev);
} else {
rc = reset_tx_pools(adapter);
if (rc)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
index 2df79fdd800b..fe21a6e2ddae 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.h
+++ b/drivers/net/ethernet/ibm/ibmvnic.h
@@ -1091,6 +1091,8 @@ struct ibmvnic_adapter {
u64 opt_rxba_entries_per_subcrq;
__be64 tx_rx_desc_req;
u8 map_id;
+ u64 num_active_rx_pools;
+ u64 num_active_tx_pools;
struct tasklet_struct tasklet;
enum vnic_state state;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net v2 2/3] ibmvnic: Revert to previous mtu when unsupported value requested
2018-01-18 22:25 [PATCH net v2 0/3] ibmvnic: Reset behavior fixes John Allen
2018-01-18 22:26 ` [PATCH net v2 1/3] ibmvnic: Modify buffer size and number of queues on failover John Allen
@ 2018-01-18 22:27 ` John Allen
2018-01-19 19:23 ` Nathan Fontenot
2018-01-18 22:27 ` [PATCH net v2 3/3] ibmvnic: Allocate and request vpd in init_resources John Allen
2018-01-22 20:47 ` [PATCH net v2 0/3] ibmvnic: Reset behavior fixes David Miller
3 siblings, 1 reply; 8+ messages in thread
From: John Allen @ 2018-01-18 22:27 UTC (permalink / raw)
To: netdev; +Cc: Thomas Falcon, Nathan Fontenot
If we request an unsupported mtu value, the vnic server will suggest a
different value. Currently we take the suggested value without question
and login with that value. However, the behavior doesn't seem completely
sane as attempting to change the mtu to some specific value will change
the mtu to some completely different value most of the time. This patch
fixes the issue by logging in with the previously used mtu value and
printing an error message saying that the given mtu is unsupported.
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 f8f1396..bb56460 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -3608,7 +3608,17 @@ static void handle_request_cap_rsp(union ibmvnic_crq *crq,
*req_value,
(long int)be64_to_cpu(crq->request_capability_rsp.
number), name);
- *req_value = be64_to_cpu(crq->request_capability_rsp.number);
+
+ if (be16_to_cpu(crq->request_capability_rsp.capability) ==
+ REQ_MTU) {
+ pr_err("mtu of %llu is not supported. Reverting.\n",
+ *req_value);
+ *req_value = adapter->fallback.mtu;
+ } else {
+ *req_value =
+ be64_to_cpu(crq->request_capability_rsp.number);
+ }
+
ibmvnic_send_req_caps(adapter, 1);
return;
default:
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net v2 3/3] ibmvnic: Allocate and request vpd in init_resources
2018-01-18 22:25 [PATCH net v2 0/3] ibmvnic: Reset behavior fixes John Allen
2018-01-18 22:26 ` [PATCH net v2 1/3] ibmvnic: Modify buffer size and number of queues on failover John Allen
2018-01-18 22:27 ` [PATCH net v2 2/3] ibmvnic: Revert to previous mtu when unsupported value requested John Allen
@ 2018-01-18 22:27 ` John Allen
2018-01-19 19:24 ` Nathan Fontenot
2018-01-22 20:47 ` [PATCH net v2 0/3] ibmvnic: Reset behavior fixes David Miller
3 siblings, 1 reply; 8+ messages in thread
From: John Allen @ 2018-01-18 22:27 UTC (permalink / raw)
To: netdev; +Cc: Thomas Falcon, Nathan Fontenot
In reset events in which our memory allocations need to be reallocated,
VPD data is being freed, but never reallocated. This can cause issues if
we later attempt to access that memory or reset and attempt to free the
memory. This patch moves the allocation of the VPD data to init_resources
so that it will be symmetrically freed during release resources.
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 bb56460..f0dbb76 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -867,7 +867,7 @@ static int ibmvnic_get_vpd(struct ibmvnic_adapter *adapter)
if (adapter->vpd->buff)
len = adapter->vpd->len;
- reinit_completion(&adapter->fw_done);
+ init_completion(&adapter->fw_done);
crq.get_vpd_size.first = IBMVNIC_CRQ_CMD;
crq.get_vpd_size.cmd = GET_VPD_SIZE;
ibmvnic_send_crq(adapter, &crq);
@@ -929,6 +929,13 @@ static int init_resources(struct ibmvnic_adapter *adapter)
if (!adapter->vpd)
return -ENOMEM;
+ /* Vital Product Data (VPD) */
+ rc = ibmvnic_get_vpd(adapter);
+ if (rc) {
+ netdev_err(netdev, "failed to initialize Vital Product Data (VPD)\n");
+ return rc;
+ }
+
adapter->map_id = 1;
adapter->napi = kcalloc(adapter->req_rx_queues,
sizeof(struct napi_struct), GFP_KERNEL);
@@ -1002,7 +1009,7 @@ static int __ibmvnic_open(struct net_device *netdev)
static int ibmvnic_open(struct net_device *netdev)
{
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
- int rc, vpd;
+ int rc;
mutex_lock(&adapter->reset_lock);
@@ -1030,11 +1037,6 @@ static int ibmvnic_open(struct net_device *netdev)
rc = __ibmvnic_open(netdev);
netif_carrier_on(netdev);
- /* Vital Product Data (VPD) */
- vpd = ibmvnic_get_vpd(adapter);
- if (vpd)
- netdev_err(netdev, "failed to initialize Vital Product Data (VPD)\n");
-
mutex_unlock(&adapter->reset_lock);
return rc;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net v2 1/3] ibmvnic: Modify buffer size and number of queues on failover
2018-01-18 22:26 ` [PATCH net v2 1/3] ibmvnic: Modify buffer size and number of queues on failover John Allen
@ 2018-01-19 19:22 ` Nathan Fontenot
0 siblings, 0 replies; 8+ messages in thread
From: Nathan Fontenot @ 2018-01-19 19:22 UTC (permalink / raw)
To: John Allen, netdev; +Cc: Thomas Falcon
On 01/18/2018 04:26 PM, John Allen wrote:
> Using newer backing devices can cause the required padding at the end of
> buffer as well as the number of queues to change after a failover.
> Since we currently assume that these values never change, after a
> failover to a backing device with different capabilities, we can get
> errors from the vnic server, attempt to free long term buffers that are
> no longer there, or not free long term buffers that should be freed.
>
> This patch resolves the issue by checking whether any of these values
> change, and if so perform the necessary re-allocations.
>
> Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
> ---
> v2: Added the line to free the long term buff in reset rx pools which
> caused me to hit a couple of other problems. On a failover, the number
> of queues can also change which doesn't get updated in the current
> reset code. Added some extra logic in do reset to check for changed
> number of queues and added some logic to release pools to ensure that
> it is only releasing pools that were allocated in the init pools
> routines.
> ---
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index 461014b7ccdd..12559c63c226 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -411,6 +411,10 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter)
> struct ibmvnic_rx_pool *rx_pool;
> int rx_scrqs;
> int i, j, rc;
> + u64 *size_array;
> +
> + 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++) {
> @@ -418,7 +422,17 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter)
>
> 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])) {
> + free_long_term_buff(adapter, &rx_pool->long_term_buff);
> + rx_pool->buff_size = be64_to_cpu(size_array[i]);
> + 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;
>
> @@ -440,14 +454,12 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter)
> static void release_rx_pools(struct ibmvnic_adapter *adapter)
> {
> struct ibmvnic_rx_pool *rx_pool;
> - int rx_scrqs;
> int i, j;
>
> if (!adapter->rx_pool)
> return;
>
> - rx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_rxadd_subcrqs);
> - for (i = 0; i < rx_scrqs; i++) {
> + for (i = 0; i < adapter->num_active_rx_pools; i++) {
> rx_pool = &adapter->rx_pool[i];
>
> netdev_dbg(adapter->netdev, "Releasing rx_pool[%d]\n", i);
> @@ -470,6 +482,7 @@ static void release_rx_pools(struct ibmvnic_adapter *adapter)
>
> kfree(adapter->rx_pool);
> adapter->rx_pool = NULL;
> + adapter->num_active_rx_pools = 0;
> }
>
> static int init_rx_pools(struct net_device *netdev)
> @@ -494,6 +507,8 @@ static int init_rx_pools(struct net_device *netdev)
> return -1;
> }
>
> + adapter->num_active_rx_pools = 0;
> +
> for (i = 0; i < rxadd_subcrqs; i++) {
> rx_pool = &adapter->rx_pool[i];
>
> @@ -537,6 +552,8 @@ static int init_rx_pools(struct net_device *netdev)
> rx_pool->next_free = 0;
> }
>
> + adapter->num_active_rx_pools = rxadd_subcrqs;
> +
> return 0;
> }
>
> @@ -587,13 +604,12 @@ static void release_vpd_data(struct ibmvnic_adapter *adapter)
> static void release_tx_pools(struct ibmvnic_adapter *adapter)
> {
> struct ibmvnic_tx_pool *tx_pool;
> - int i, tx_scrqs;
> + int i;
>
> if (!adapter->tx_pool)
> return;
>
> - tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs);
> - for (i = 0; i < tx_scrqs; i++) {
> + for (i = 0; i < adapter->num_active_tx_pools; i++) {
> netdev_dbg(adapter->netdev, "Releasing tx_pool[%d]\n", i);
> tx_pool = &adapter->tx_pool[i];
> kfree(tx_pool->tx_buff);
> @@ -604,6 +620,7 @@ static void release_tx_pools(struct ibmvnic_adapter *adapter)
>
> kfree(adapter->tx_pool);
> adapter->tx_pool = NULL;
> + adapter->num_active_tx_pools = 0;
> }
>
> static int init_tx_pools(struct net_device *netdev)
> @@ -620,6 +637,8 @@ static int init_tx_pools(struct net_device *netdev)
> if (!adapter->tx_pool)
> return -1;
>
> + adapter->num_active_tx_pools = 0;
> +
> for (i = 0; i < tx_subcrqs; i++) {
> tx_pool = &adapter->tx_pool[i];
>
> @@ -667,6 +686,8 @@ static int init_tx_pools(struct net_device *netdev)
> tx_pool->producer_index = 0;
> }
>
> + adapter->num_active_tx_pools = tx_subcrqs;
> +
> return 0;
> }
>
> @@ -1550,6 +1571,7 @@ static int ibmvnic_set_mac(struct net_device *netdev, void *p)
> static int do_reset(struct ibmvnic_adapter *adapter,
> struct ibmvnic_rwi *rwi, u32 reset_state)
> {
> + u64 old_num_rx_queues, old_num_tx_queues;
> struct net_device *netdev = adapter->netdev;
> int i, rc;
>
> @@ -1559,6 +1581,9 @@ static int do_reset(struct ibmvnic_adapter *adapter,
> netif_carrier_off(netdev);
> adapter->reset_reason = rwi->reset_reason;
>
> + old_num_rx_queues = adapter->req_rx_queues;
> + old_num_tx_queues = adapter->req_tx_queues;
> +
> if (rwi->reset_reason == VNIC_RESET_MOBILITY) {
> rc = ibmvnic_reenable_crq_queue(adapter);
> if (rc)
> @@ -1603,6 +1628,12 @@ static int do_reset(struct ibmvnic_adapter *adapter,
> rc = init_resources(adapter);
> if (rc)
> return rc;
> + } else if (adapter->req_rx_queues != old_num_rx_queues ||
> + adapter->req_tx_queues != old_num_tx_queues) {
> + release_rx_pools(adapter);
> + release_tx_pools(adapter);
> + init_rx_pools(netdev);
> + init_tx_pools(netdev);
> } else {
> rc = reset_tx_pools(adapter);
> if (rc)
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
> index 2df79fdd800b..fe21a6e2ddae 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.h
> +++ b/drivers/net/ethernet/ibm/ibmvnic.h
> @@ -1091,6 +1091,8 @@ struct ibmvnic_adapter {
> u64 opt_rxba_entries_per_subcrq;
> __be64 tx_rx_desc_req;
> u8 map_id;
> + u64 num_active_rx_pools;
> + u64 num_active_tx_pools;
>
> struct tasklet_struct tasklet;
> enum vnic_state state;
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net v2 2/3] ibmvnic: Revert to previous mtu when unsupported value requested
2018-01-18 22:27 ` [PATCH net v2 2/3] ibmvnic: Revert to previous mtu when unsupported value requested John Allen
@ 2018-01-19 19:23 ` Nathan Fontenot
0 siblings, 0 replies; 8+ messages in thread
From: Nathan Fontenot @ 2018-01-19 19:23 UTC (permalink / raw)
To: John Allen, netdev; +Cc: Thomas Falcon
On 01/18/2018 04:27 PM, John Allen wrote:
> If we request an unsupported mtu value, the vnic server will suggest a
> different value. Currently we take the suggested value without question
> and login with that value. However, the behavior doesn't seem completely
> sane as attempting to change the mtu to some specific value will change
> the mtu to some completely different value most of the time. This patch
> fixes the issue by logging in with the previously used mtu value and
> printing an error message saying that the given mtu is unsupported.
>
> Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
> ---
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index f8f1396..bb56460 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -3608,7 +3608,17 @@ static void handle_request_cap_rsp(union ibmvnic_crq *crq,
> *req_value,
> (long int)be64_to_cpu(crq->request_capability_rsp.
> number), name);
> - *req_value = be64_to_cpu(crq->request_capability_rsp.number);
> +
> + if (be16_to_cpu(crq->request_capability_rsp.capability) ==
> + REQ_MTU) {
> + pr_err("mtu of %llu is not supported. Reverting.\n",
> + *req_value);
> + *req_value = adapter->fallback.mtu;
> + } else {
> + *req_value =
> + be64_to_cpu(crq->request_capability_rsp.number);
> + }
> +
> ibmvnic_send_req_caps(adapter, 1);
> return;
> default:
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net v2 3/3] ibmvnic: Allocate and request vpd in init_resources
2018-01-18 22:27 ` [PATCH net v2 3/3] ibmvnic: Allocate and request vpd in init_resources John Allen
@ 2018-01-19 19:24 ` Nathan Fontenot
0 siblings, 0 replies; 8+ messages in thread
From: Nathan Fontenot @ 2018-01-19 19:24 UTC (permalink / raw)
To: John Allen, netdev; +Cc: Thomas Falcon
On 01/18/2018 04:27 PM, John Allen wrote:
> In reset events in which our memory allocations need to be reallocated,
> VPD data is being freed, but never reallocated. This can cause issues if
> we later attempt to access that memory or reset and attempt to free the
> memory. This patch moves the allocation of the VPD data to init_resources
> so that it will be symmetrically freed during release resources.
>
> Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
> ---
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index bb56460..f0dbb76 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -867,7 +867,7 @@ static int ibmvnic_get_vpd(struct ibmvnic_adapter *adapter)
> if (adapter->vpd->buff)
> len = adapter->vpd->len;
>
> - reinit_completion(&adapter->fw_done);
> + init_completion(&adapter->fw_done);
> crq.get_vpd_size.first = IBMVNIC_CRQ_CMD;
> crq.get_vpd_size.cmd = GET_VPD_SIZE;
> ibmvnic_send_crq(adapter, &crq);
> @@ -929,6 +929,13 @@ static int init_resources(struct ibmvnic_adapter *adapter)
> if (!adapter->vpd)
> return -ENOMEM;
>
> + /* Vital Product Data (VPD) */
> + rc = ibmvnic_get_vpd(adapter);
> + if (rc) {
> + netdev_err(netdev, "failed to initialize Vital Product Data (VPD)\n");
> + return rc;
> + }
> +
> adapter->map_id = 1;
> adapter->napi = kcalloc(adapter->req_rx_queues,
> sizeof(struct napi_struct), GFP_KERNEL);
> @@ -1002,7 +1009,7 @@ static int __ibmvnic_open(struct net_device *netdev)
> static int ibmvnic_open(struct net_device *netdev)
> {
> struct ibmvnic_adapter *adapter = netdev_priv(netdev);
> - int rc, vpd;
> + int rc;
>
> mutex_lock(&adapter->reset_lock);
>
> @@ -1030,11 +1037,6 @@ static int ibmvnic_open(struct net_device *netdev)
> rc = __ibmvnic_open(netdev);
> netif_carrier_on(netdev);
>
> - /* Vital Product Data (VPD) */
> - vpd = ibmvnic_get_vpd(adapter);
> - if (vpd)
> - netdev_err(netdev, "failed to initialize Vital Product Data (VPD)\n");
> -
> mutex_unlock(&adapter->reset_lock);
>
> return rc;
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net v2 0/3] ibmvnic: Reset behavior fixes
2018-01-18 22:25 [PATCH net v2 0/3] ibmvnic: Reset behavior fixes John Allen
` (2 preceding siblings ...)
2018-01-18 22:27 ` [PATCH net v2 3/3] ibmvnic: Allocate and request vpd in init_resources John Allen
@ 2018-01-22 20:47 ` David Miller
3 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2018-01-22 20:47 UTC (permalink / raw)
To: jallen; +Cc: netdev, tlfalcon, nfont
From: John Allen <jallen@linux.vnet.ibm.com>
Date: Thu, 18 Jan 2018 16:25:39 -0600
> This patchset fixes a number of issues related to ibmvnic reset uncovered
> from testing new Power9 machines with Everglades adapters and the new
> functionality to change mtu and other parameters in the driver.
>
> Changes since v1:
> -In patch 1/3, added the line to free the long term buffers before
> allocating a new one. This change inadvertently uncovered the problem
> that the number of queues can change after a failover as well. To fix
> this, we check whether or not the number of queues has changed in
> do_reset and if they have, we do a full release and init of the queues.
> -In patch 1/3, added variables to the adapter struct to track how
> many rx/tx pools have actually been allocated and modify the release
> pools routines to use these values rather than the possibly incorrect
> req_rx/tx_queues values.
Series applied, thanks John.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-01-22 20:47 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-18 22:25 [PATCH net v2 0/3] ibmvnic: Reset behavior fixes John Allen
2018-01-18 22:26 ` [PATCH net v2 1/3] ibmvnic: Modify buffer size and number of queues on failover John Allen
2018-01-19 19:22 ` Nathan Fontenot
2018-01-18 22:27 ` [PATCH net v2 2/3] ibmvnic: Revert to previous mtu when unsupported value requested John Allen
2018-01-19 19:23 ` Nathan Fontenot
2018-01-18 22:27 ` [PATCH net v2 3/3] ibmvnic: Allocate and request vpd in init_resources John Allen
2018-01-19 19:24 ` Nathan Fontenot
2018-01-22 20:47 ` [PATCH net v2 0/3] ibmvnic: Reset behavior fixes David Miller
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).