* [PATCH net 0/7] Aquantia atlantic hot fixes 03-2018
@ 2018-03-16 10:53 Igor Russkikh
2018-03-16 10:53 ` [PATCH net 1/7] net: aquantia: Fix hardware reset when SPI may rarely hangup Igor Russkikh
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Igor Russkikh @ 2018-03-16 10:53 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh
This is a set of atlantic driver hot fixes for various areas:
Some rare issues with hardware reset covered,
Fixed napi_poll flood happening on some traffic conditions,
Allow system to change MAC address on live device,
Add pci shutdown handler.
Igor Russkikh (7):
net: aquantia: Fix hardware reset when SPI may rarely hangup
net: aquantia: Fix a regression with reset on old firmware
net: aquantia: Change inefficient wait loop on fw data reads
net: aquantia: Add aq_tx_clean_budget and valid budget handling logic
net: aquantia: Allow live mac address changes
net: aquantia: Implement pci shutdown callback
net: aquantia: driver version bump
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 26 +++++++++
drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 3 +
.../net/ethernet/aquantia/atlantic/aq_pci_func.c | 15 +++++
drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 7 ++-
drivers/net/ethernet/aquantia/atlantic/aq_ring.h | 2 +-
drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 7 +--
.../aquantia/atlantic/hw_atl/hw_atl_utils.c | 66 +++++++++++++++-------
.../aquantia/atlantic/hw_atl/hw_atl_utils.h | 1 +
drivers/net/ethernet/aquantia/atlantic/ver.h | 2 +-
9 files changed, 101 insertions(+), 28 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net 1/7] net: aquantia: Fix hardware reset when SPI may rarely hangup
2018-03-16 10:53 [PATCH net 0/7] Aquantia atlantic hot fixes 03-2018 Igor Russkikh
@ 2018-03-16 10:53 ` Igor Russkikh
2018-03-16 18:50 ` David Miller
2018-03-16 10:53 ` [PATCH net 2/7] net: aquantia: Fix a regression with reset on old firmware Igor Russkikh
` (5 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Igor Russkikh @ 2018-03-16 10:53 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh
Under some circumstances (notably using thunderbolt interface) SPI
on chip reset may be in active transaction.
Here we forcibly cleanup SPI to prevent possible hangups.
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
.../ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
index 967f0fd..0da480b 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
@@ -80,15 +80,14 @@ int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops)
static int hw_atl_utils_soft_reset_flb(struct aq_hw_s *self)
{
int k = 0;
- u32 gsr;
+ u32 gsr, val;
aq_hw_write_reg(self, 0x404, 0x40e1);
AQ_HW_SLEEP(50);
/* Cleanup SPI */
- aq_hw_write_reg(self, 0x534, 0xA0);
- aq_hw_write_reg(self, 0x100, 0x9F);
- aq_hw_write_reg(self, 0x100, 0x809F);
+ val = aq_hw_read_reg(self, 0x53C);
+ aq_hw_write_reg(self, 0x53C, val | 0x10);
gsr = aq_hw_read_reg(self, HW_ATL_GLB_SOFT_RES_ADR);
aq_hw_write_reg(self, HW_ATL_GLB_SOFT_RES_ADR, (gsr & 0xBFFF) | 0x8000);
@@ -97,7 +96,14 @@ static int hw_atl_utils_soft_reset_flb(struct aq_hw_s *self)
aq_hw_write_reg(self, 0x404, 0x80e0);
aq_hw_write_reg(self, 0x32a8, 0x0);
aq_hw_write_reg(self, 0x520, 0x1);
+
+ /* Reset SPI again because of possible interrupted SPI burst */
+ val = aq_hw_read_reg(self, 0x53C);
+ aq_hw_write_reg(self, 0x53C, val | 0x10);
AQ_HW_SLEEP(10);
+ /* Clear SPI reset state */
+ aq_hw_write_reg(self, 0x53C, val & ~0x10);
+
aq_hw_write_reg(self, 0x404, 0x180e0);
for (k = 0; k < 1000; k++) {
@@ -147,7 +153,7 @@ static int hw_atl_utils_soft_reset_flb(struct aq_hw_s *self)
static int hw_atl_utils_soft_reset_rbl(struct aq_hw_s *self)
{
- u32 gsr, rbl_status;
+ u32 gsr, val, rbl_status;
int k;
aq_hw_write_reg(self, 0x404, 0x40e1);
@@ -157,6 +163,10 @@ static int hw_atl_utils_soft_reset_rbl(struct aq_hw_s *self)
/* Alter RBL status */
aq_hw_write_reg(self, 0x388, 0xDEAD);
+ /* Cleanup SPI */
+ val = aq_hw_read_reg(self, 0x53C);
+ aq_hw_write_reg(self, 0x53C, val | 0x10);
+
/* Global software reset*/
hw_atl_rx_rx_reg_res_dis_set(self, 0U);
hw_atl_tx_tx_reg_res_dis_set(self, 0U);
--
2.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net 2/7] net: aquantia: Fix a regression with reset on old firmware
2018-03-16 10:53 [PATCH net 0/7] Aquantia atlantic hot fixes 03-2018 Igor Russkikh
2018-03-16 10:53 ` [PATCH net 1/7] net: aquantia: Fix hardware reset when SPI may rarely hangup Igor Russkikh
@ 2018-03-16 10:53 ` Igor Russkikh
2018-03-16 10:53 ` [PATCH net 3/7] net: aquantia: Change inefficient wait loop on fw data reads Igor Russkikh
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Igor Russkikh @ 2018-03-16 10:53 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh
FW 1.5.58 and below needs a fixed delay even after 0x18 register
is filled. Otherwise, setting MPI_INIT state too fast causes
traffic hang.
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
index 0da480b..9a53a4c 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
@@ -147,6 +147,8 @@ static int hw_atl_utils_soft_reset_flb(struct aq_hw_s *self)
aq_pr_err("FW kickstart failed\n");
return -EIO;
}
+ /* Old FW requires fixed delay after init */
+ AQ_HW_SLEEP(15);
return 0;
}
@@ -214,6 +216,8 @@ static int hw_atl_utils_soft_reset_rbl(struct aq_hw_s *self)
aq_pr_err("FW kickstart failed\n");
return -EIO;
}
+ /* Old FW requires fixed delay after init */
+ AQ_HW_SLEEP(15);
return 0;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net 3/7] net: aquantia: Change inefficient wait loop on fw data reads
2018-03-16 10:53 [PATCH net 0/7] Aquantia atlantic hot fixes 03-2018 Igor Russkikh
2018-03-16 10:53 ` [PATCH net 1/7] net: aquantia: Fix hardware reset when SPI may rarely hangup Igor Russkikh
2018-03-16 10:53 ` [PATCH net 2/7] net: aquantia: Fix a regression with reset on old firmware Igor Russkikh
@ 2018-03-16 10:53 ` Igor Russkikh
2018-03-16 10:53 ` [PATCH net 4/7] net: aquantia: Add aq_tx_clean_budget and valid budget handling logic Igor Russkikh
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Igor Russkikh @ 2018-03-16 10:53 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh
B1 hardware changes behavior of mailbox interface, it has busy bit
always raised. Data ready condition should be detected by increment
of address register.
Old code has empty `for` loop, and that caused cpu overloads on B1
hardware. aq_nic_service_timer_cb consumed ~100ms because of that.
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
.../aquantia/atlantic/hw_atl/hw_atl_utils.c | 42 ++++++++++++++--------
.../aquantia/atlantic/hw_atl/hw_atl_utils.h | 1 +
2 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
index 9a53a4c..2accffc 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
@@ -21,6 +21,10 @@
#define HW_ATL_UCP_0X370_REG 0x0370U
+#define HW_ATL_MIF_CMD 0x0200U
+#define HW_ATL_MIF_ADDR 0x0208U
+#define HW_ATL_MIF_VAL 0x020CU
+
#define HW_ATL_FW_SM_RAM 0x2U
#define HW_ATL_MPI_FW_VERSION 0x18
#define HW_ATL_MPI_CONTROL_ADR 0x0368U
@@ -269,18 +273,22 @@ int hw_atl_utils_fw_downld_dwords(struct aq_hw_s *self, u32 a,
}
}
- aq_hw_write_reg(self, 0x00000208U, a);
-
- for (++cnt; --cnt;) {
- u32 i = 0U;
+ aq_hw_write_reg(self, HW_ATL_MIF_ADDR, a);
- aq_hw_write_reg(self, 0x00000200U, 0x00008000U);
+ for (++cnt; --cnt && !err;) {
+ aq_hw_write_reg(self, HW_ATL_MIF_CMD, 0x00008000U);
- for (i = 1024U;
- (0x100U & aq_hw_read_reg(self, 0x00000200U)) && --i;) {
- }
+ if (IS_CHIP_FEATURE(REVISION_B1))
+ AQ_HW_WAIT_FOR(a != aq_hw_read_reg(self,
+ HW_ATL_MIF_ADDR),
+ 1, 1000U);
+ else
+ AQ_HW_WAIT_FOR(!(0x100 & aq_hw_read_reg(self,
+ HW_ATL_MIF_CMD)),
+ 1, 1000U);
- *(p++) = aq_hw_read_reg(self, 0x0000020CU);
+ *(p++) = aq_hw_read_reg(self, HW_ATL_MIF_VAL);
+ a += 4;
}
hw_atl_reg_glb_cpu_sem_set(self, 1U, HW_ATL_FW_SM_RAM);
@@ -676,14 +684,18 @@ void hw_atl_utils_hw_chip_features_init(struct aq_hw_s *self, u32 *p)
u32 val = hw_atl_reg_glb_mif_id_get(self);
u32 mif_rev = val & 0xFFU;
- if ((3U & mif_rev) == 1U) {
- chip_features |=
- HAL_ATLANTIC_UTILS_CHIP_REVISION_A0 |
+ if ((0xFU & mif_rev) == 1U) {
+ chip_features |= HAL_ATLANTIC_UTILS_CHIP_REVISION_A0 |
HAL_ATLANTIC_UTILS_CHIP_MPI_AQ |
HAL_ATLANTIC_UTILS_CHIP_MIPS;
- } else if ((3U & mif_rev) == 2U) {
- chip_features |=
- HAL_ATLANTIC_UTILS_CHIP_REVISION_B0 |
+ } else if ((0xFU & mif_rev) == 2U) {
+ chip_features |= HAL_ATLANTIC_UTILS_CHIP_REVISION_B0 |
+ HAL_ATLANTIC_UTILS_CHIP_MPI_AQ |
+ HAL_ATLANTIC_UTILS_CHIP_MIPS |
+ HAL_ATLANTIC_UTILS_CHIP_TPO2 |
+ HAL_ATLANTIC_UTILS_CHIP_RPF2;
+ } else if ((0xFU & mif_rev) == 0xAU) {
+ chip_features |= HAL_ATLANTIC_UTILS_CHIP_REVISION_B1 |
HAL_ATLANTIC_UTILS_CHIP_MPI_AQ |
HAL_ATLANTIC_UTILS_CHIP_MIPS |
HAL_ATLANTIC_UTILS_CHIP_TPO2 |
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h
index 2c69094..cd8f18f 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h
@@ -161,6 +161,7 @@ struct __packed hw_aq_atl_utils_mbox {
#define HAL_ATLANTIC_UTILS_CHIP_MPI_AQ 0x00000010U
#define HAL_ATLANTIC_UTILS_CHIP_REVISION_A0 0x01000000U
#define HAL_ATLANTIC_UTILS_CHIP_REVISION_B0 0x02000000U
+#define HAL_ATLANTIC_UTILS_CHIP_REVISION_B1 0x04000000U
#define IS_CHIP_FEATURE(_F_) (HAL_ATLANTIC_UTILS_CHIP_##_F_ & \
self->chip_features)
--
2.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net 4/7] net: aquantia: Add aq_tx_clean_budget and valid budget handling logic
2018-03-16 10:53 [PATCH net 0/7] Aquantia atlantic hot fixes 03-2018 Igor Russkikh
` (2 preceding siblings ...)
2018-03-16 10:53 ` [PATCH net 3/7] net: aquantia: Change inefficient wait loop on fw data reads Igor Russkikh
@ 2018-03-16 10:53 ` Igor Russkikh
2018-03-16 18:51 ` David Miller
2018-03-16 10:53 ` [PATCH net 5/7] net: aquantia: Allow live mac address changes Igor Russkikh
` (2 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Igor Russkikh @ 2018-03-16 10:53 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh
We should report to napi full budget only when we have more job to do.
Before this fix, on any tx queue cleanup we forced napi to do poll again.
Thats a waste of cpu resources and caused storming with napi polls when
there was at least one tx on each interrupt.
With this fix we report full budget only when there is more job on TX
to do. Or, as before, when rx budget was fully consumed.
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 4 ++++
drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 2 ++
drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 7 +++++--
drivers/net/ethernet/aquantia/atlantic/aq_ring.h | 2 +-
drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 7 +++----
5 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index ebbaf63..5723f2c 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -36,6 +36,10 @@ static unsigned int aq_itr_rx;
module_param_named(aq_itr_rx, aq_itr_rx, uint, 0644);
MODULE_PARM_DESC(aq_itr_rx, "RX interrupt throttle rate");
+unsigned aq_tx_clean_budget = 256;
+module_param_named(aq_tx_clean_budget, aq_tx_clean_budget, uint, 0644);
+MODULE_PARM_DESC(aq_tx_clean_budget, "Maximum descriptors to cleanup on TX at once");
+
static void aq_nic_update_ndev_stats(struct aq_nic_s *self);
static void aq_nic_rss_init(struct aq_nic_s *self, unsigned int num_rss_queues)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
index d16b0f1..2b689b7 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
@@ -87,6 +87,8 @@ static inline struct device *aq_nic_get_dev(struct aq_nic_s *self)
return self->ndev->dev.parent;
}
+extern unsigned aq_tx_clean_budget;
+
void aq_nic_ndev_init(struct aq_nic_s *self);
struct aq_nic_s *aq_nic_alloc_hot(struct net_device *ndev);
void aq_nic_set_tx_ring(struct aq_nic_s *self, unsigned int idx,
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
index 0be6a11..64a6de6 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
@@ -136,11 +136,12 @@ void aq_ring_queue_stop(struct aq_ring_s *ring)
netif_stop_subqueue(ndev, ring->idx);
}
-void aq_ring_tx_clean(struct aq_ring_s *self)
+bool aq_ring_tx_clean(struct aq_ring_s *self)
{
struct device *dev = aq_nic_get_dev(self->aq_nic);
+ unsigned int budget = aq_tx_clean_budget;
- for (; self->sw_head != self->hw_head;
+ for (; self->sw_head != self->hw_head && budget--;
self->sw_head = aq_ring_next_dx(self, self->sw_head)) {
struct aq_ring_buff_s *buff = &self->buff_ring[self->sw_head];
@@ -167,6 +168,8 @@ void aq_ring_tx_clean(struct aq_ring_s *self)
buff->pa = 0U;
buff->eop_index = 0xffffU;
}
+
+ return !!budget;
}
#define AQ_SKB_ALIGN SKB_DATA_ALIGN(sizeof(struct skb_shared_info))
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.h b/drivers/net/ethernet/aquantia/atlantic/aq_ring.h
index 965fae0..ac1329f 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.h
@@ -153,7 +153,7 @@ void aq_ring_free(struct aq_ring_s *self);
void aq_ring_update_queue_state(struct aq_ring_s *ring);
void aq_ring_queue_wake(struct aq_ring_s *ring);
void aq_ring_queue_stop(struct aq_ring_s *ring);
-void aq_ring_tx_clean(struct aq_ring_s *self);
+bool aq_ring_tx_clean(struct aq_ring_s *self);
int aq_ring_rx_clean(struct aq_ring_s *self,
struct napi_struct *napi,
int *work_done,
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
index f890b8a..9528507 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
@@ -40,7 +40,7 @@ static int aq_vec_poll(struct napi_struct *napi, int budget)
int err = 0;
unsigned int i = 0U;
unsigned int sw_tail_old = 0U;
- bool was_tx_cleaned = false;
+ bool was_tx_cleaned = true;
if (!self) {
err = -EINVAL;
@@ -57,9 +57,8 @@ static int aq_vec_poll(struct napi_struct *napi, int budget)
if (ring[AQ_VEC_TX_ID].sw_head !=
ring[AQ_VEC_TX_ID].hw_head) {
- aq_ring_tx_clean(&ring[AQ_VEC_TX_ID]);
+ was_tx_cleaned = aq_ring_tx_clean(&ring[AQ_VEC_TX_ID]);
aq_ring_update_queue_state(&ring[AQ_VEC_TX_ID]);
- was_tx_cleaned = true;
}
err = self->aq_hw_ops->hw_ring_rx_receive(self->aq_hw,
@@ -90,7 +89,7 @@ static int aq_vec_poll(struct napi_struct *napi, int budget)
}
}
- if (was_tx_cleaned)
+ if (!was_tx_cleaned)
work_done = budget;
if (work_done < budget) {
--
2.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net 5/7] net: aquantia: Allow live mac address changes
2018-03-16 10:53 [PATCH net 0/7] Aquantia atlantic hot fixes 03-2018 Igor Russkikh
` (3 preceding siblings ...)
2018-03-16 10:53 ` [PATCH net 4/7] net: aquantia: Add aq_tx_clean_budget and valid budget handling logic Igor Russkikh
@ 2018-03-16 10:53 ` Igor Russkikh
2018-03-16 10:53 ` [PATCH net 6/7] net: aquantia: Implement pci shutdown callback Igor Russkikh
2018-03-16 10:53 ` [PATCH net 7/7] net: aquantia: driver version bump Igor Russkikh
6 siblings, 0 replies; 12+ messages in thread
From: Igor Russkikh @ 2018-03-16 10:53 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh
There is nothing prevents us from changing MAC on the running interface.
Allow this with ndev priv flag.
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index 5723f2c..f32e4b3 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -251,6 +251,8 @@ void aq_nic_ndev_init(struct aq_nic_s *self)
self->ndev->hw_features |= aq_hw_caps->hw_features;
self->ndev->features = aq_hw_caps->hw_features;
self->ndev->priv_flags = aq_hw_caps->hw_priv_flags;
+ self->ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
+
self->ndev->mtu = aq_nic_cfg->mtu - ETH_HLEN;
self->ndev->max_mtu = aq_hw_caps->mtu - ETH_FCS_LEN - ETH_HLEN;
--
2.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net 6/7] net: aquantia: Implement pci shutdown callback
2018-03-16 10:53 [PATCH net 0/7] Aquantia atlantic hot fixes 03-2018 Igor Russkikh
` (4 preceding siblings ...)
2018-03-16 10:53 ` [PATCH net 5/7] net: aquantia: Allow live mac address changes Igor Russkikh
@ 2018-03-16 10:53 ` Igor Russkikh
2018-03-16 10:53 ` [PATCH net 7/7] net: aquantia: driver version bump Igor Russkikh
6 siblings, 0 replies; 12+ messages in thread
From: Igor Russkikh @ 2018-03-16 10:53 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh
We should close link and all NIC operations during shutdown.
On some systems graceful reboot never closes NIC interface on its own,
but only indicates pci device shutdown. Without explicit handler, NIC
rx rings continued to transfer DMA data into prepared buffers while CPU
rebooted already. That caused memory corruptions on soft reboot.
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 20 ++++++++++++++++++++
drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 1 +
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c | 15 +++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index f32e4b3..79b0914 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -943,3 +943,23 @@ int aq_nic_change_pm_state(struct aq_nic_s *self, pm_message_t *pm_msg)
out:
return err;
}
+
+void aq_nic_shutdown(struct aq_nic_s *self)
+{
+ int err = 0;
+
+ if (!self->ndev)
+ return;
+
+ rtnl_lock();
+
+ netif_device_detach(self->ndev);
+
+ err = aq_nic_stop(self);
+ if (err < 0)
+ goto err_exit;
+ aq_nic_deinit(self);
+
+err_exit:
+ rtnl_unlock();
+}
\ No newline at end of file
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
index 2b689b7..b770eeb 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
@@ -120,5 +120,6 @@ struct aq_nic_cfg_s *aq_nic_get_cfg(struct aq_nic_s *self);
u32 aq_nic_get_fw_version(struct aq_nic_s *self);
int aq_nic_change_pm_state(struct aq_nic_s *self, pm_message_t *pm_msg);
int aq_nic_update_interrupt_moderation_settings(struct aq_nic_s *self);
+void aq_nic_shutdown(struct aq_nic_s *self);
#endif /* AQ_NIC_H */
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
index 87c4308..ecc6306 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
@@ -323,6 +323,20 @@ static void aq_pci_remove(struct pci_dev *pdev)
pci_disable_device(pdev);
}
+static void aq_pci_shutdown(struct pci_dev *pdev)
+{
+ struct aq_nic_s *self = pci_get_drvdata(pdev);
+
+ aq_nic_shutdown(self);
+
+ pci_disable_device(pdev);
+
+ if (system_state == SYSTEM_POWER_OFF) {
+ pci_wake_from_d3(pdev, false);
+ pci_set_power_state(pdev, PCI_D3hot);
+ }
+}
+
static int aq_pci_suspend(struct pci_dev *pdev, pm_message_t pm_msg)
{
struct aq_nic_s *self = pci_get_drvdata(pdev);
@@ -345,6 +359,7 @@ static struct pci_driver aq_pci_ops = {
.remove = aq_pci_remove,
.suspend = aq_pci_suspend,
.resume = aq_pci_resume,
+ .shutdown = aq_pci_shutdown,
};
module_pci_driver(aq_pci_ops);
--
2.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net 7/7] net: aquantia: driver version bump
2018-03-16 10:53 [PATCH net 0/7] Aquantia atlantic hot fixes 03-2018 Igor Russkikh
` (5 preceding siblings ...)
2018-03-16 10:53 ` [PATCH net 6/7] net: aquantia: Implement pci shutdown callback Igor Russkikh
@ 2018-03-16 10:53 ` Igor Russkikh
6 siblings, 0 replies; 12+ messages in thread
From: Igor Russkikh @ 2018-03-16 10:53 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
drivers/net/ethernet/aquantia/atlantic/ver.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/ver.h b/drivers/net/ethernet/aquantia/atlantic/ver.h
index 5265b93..a445de6 100644
--- a/drivers/net/ethernet/aquantia/atlantic/ver.h
+++ b/drivers/net/ethernet/aquantia/atlantic/ver.h
@@ -13,7 +13,7 @@
#define NIC_MAJOR_DRIVER_VERSION 2
#define NIC_MINOR_DRIVER_VERSION 0
#define NIC_BUILD_DRIVER_VERSION 2
-#define NIC_REVISION_DRIVER_VERSION 0
+#define NIC_REVISION_DRIVER_VERSION 1
#define AQ_CFG_DRV_VERSION_SUFFIX "-kern"
--
2.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH net 1/7] net: aquantia: Fix hardware reset when SPI may rarely hangup
2018-03-16 10:53 ` [PATCH net 1/7] net: aquantia: Fix hardware reset when SPI may rarely hangup Igor Russkikh
@ 2018-03-16 18:50 ` David Miller
0 siblings, 0 replies; 12+ messages in thread
From: David Miller @ 2018-03-16 18:50 UTC (permalink / raw)
To: igor.russkikh; +Cc: netdev, darcari, pavel.belous
From: Igor Russkikh <igor.russkikh@aquantia.com>
Date: Fri, 16 Mar 2018 13:53:44 +0300
> diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
> index 967f0fd..0da480b 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
> @@ -80,15 +80,14 @@ int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops)
> static int hw_atl_utils_soft_reset_flb(struct aq_hw_s *self)
> {
> int k = 0;
> - u32 gsr;
> + u32 gsr, val;
Please preserve the reverse christmas tree ordering (longest to shortest line) for
variable declarations here.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net 4/7] net: aquantia: Add aq_tx_clean_budget and valid budget handling logic
2018-03-16 10:53 ` [PATCH net 4/7] net: aquantia: Add aq_tx_clean_budget and valid budget handling logic Igor Russkikh
@ 2018-03-16 18:51 ` David Miller
2018-03-19 11:18 ` Igor Russkikh
0 siblings, 1 reply; 12+ messages in thread
From: David Miller @ 2018-03-16 18:51 UTC (permalink / raw)
To: igor.russkikh; +Cc: netdev, darcari, pavel.belous
From: Igor Russkikh <igor.russkikh@aquantia.com>
Date: Fri, 16 Mar 2018 13:53:47 +0300
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> index ebbaf63..5723f2c 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> @@ -36,6 +36,10 @@ static unsigned int aq_itr_rx;
> module_param_named(aq_itr_rx, aq_itr_rx, uint, 0644);
> MODULE_PARM_DESC(aq_itr_rx, "RX interrupt throttle rate");
>
> +unsigned aq_tx_clean_budget = 256;
> +module_param_named(aq_tx_clean_budget, aq_tx_clean_budget, uint, 0644);
> +MODULE_PARM_DESC(aq_tx_clean_budget, "Maximum descriptors to cleanup on TX at once");
> +
> static void aq_nic_update_ndev_stats(struct aq_nic_s *self);
Please do not add driver private module parameter knobs like this.
Instead, please use a existing, device agnostic, runtime,
configuration mechanism to control this.
Thank you.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net 4/7] net: aquantia: Add aq_tx_clean_budget and valid budget handling logic
2018-03-16 18:51 ` David Miller
@ 2018-03-19 11:18 ` Igor Russkikh
2018-03-19 13:36 ` David Miller
0 siblings, 1 reply; 12+ messages in thread
From: Igor Russkikh @ 2018-03-19 11:18 UTC (permalink / raw)
To: David Miller; +Cc: netdev, darcari, pavel.belous
Hi David,
Thanks for the comments.
>>
>> +unsigned aq_tx_clean_budget = 256;
>> +module_param_named(aq_tx_clean_budget, aq_tx_clean_budget, uint, 0644);
>> +MODULE_PARM_DESC(aq_tx_clean_budget, "Maximum descriptors to cleanup on TX at once");
>> +
>> static void aq_nic_update_ndev_stats(struct aq_nic_s *self);
>
> Please do not add driver private module parameter knobs like this.
>
> Instead, please use a existing, device agnostic, runtime,
> configuration mechanism to control this.
I'm not aware of any existing standard way to configure tx cleanup budget.
Many drivers just have it hardcoded via define. Is that what you suggest then?
BR, Igor
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net 4/7] net: aquantia: Add aq_tx_clean_budget and valid budget handling logic
2018-03-19 11:18 ` Igor Russkikh
@ 2018-03-19 13:36 ` David Miller
0 siblings, 0 replies; 12+ messages in thread
From: David Miller @ 2018-03-19 13:36 UTC (permalink / raw)
To: igor.russkikh; +Cc: netdev, darcari, pavel.belous
From: Igor Russkikh <igor.russkikh@aquantia.com>
Date: Mon, 19 Mar 2018 14:18:55 +0300
>
> Hi David,
>
> Thanks for the comments.
>
>>>
>>> +unsigned aq_tx_clean_budget = 256;
>>> +module_param_named(aq_tx_clean_budget, aq_tx_clean_budget, uint, 0644);
>>> +MODULE_PARM_DESC(aq_tx_clean_budget, "Maximum descriptors to cleanup on TX at once");
>>> +
>>> static void aq_nic_update_ndev_stats(struct aq_nic_s *self);
>>
>> Please do not add driver private module parameter knobs like this.
>>
>> Instead, please use a existing, device agnostic, runtime,
>> configuration mechanism to control this.
>
> I'm not aware of any existing standard way to configure tx cleanup budget.
> Many drivers just have it hardcoded via define. Is that what you suggest then?
You can hard code it, or find some way to make ethtool support this and
therefore make the configuration available generically for all drivers
which may want to allow tweaking this.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2018-03-19 13:37 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-16 10:53 [PATCH net 0/7] Aquantia atlantic hot fixes 03-2018 Igor Russkikh
2018-03-16 10:53 ` [PATCH net 1/7] net: aquantia: Fix hardware reset when SPI may rarely hangup Igor Russkikh
2018-03-16 18:50 ` David Miller
2018-03-16 10:53 ` [PATCH net 2/7] net: aquantia: Fix a regression with reset on old firmware Igor Russkikh
2018-03-16 10:53 ` [PATCH net 3/7] net: aquantia: Change inefficient wait loop on fw data reads Igor Russkikh
2018-03-16 10:53 ` [PATCH net 4/7] net: aquantia: Add aq_tx_clean_budget and valid budget handling logic Igor Russkikh
2018-03-16 18:51 ` David Miller
2018-03-19 11:18 ` Igor Russkikh
2018-03-19 13:36 ` David Miller
2018-03-16 10:53 ` [PATCH net 5/7] net: aquantia: Allow live mac address changes Igor Russkikh
2018-03-16 10:53 ` [PATCH net 6/7] net: aquantia: Implement pci shutdown callback Igor Russkikh
2018-03-16 10:53 ` [PATCH net 7/7] net: aquantia: driver version bump Igor Russkikh
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).