* [PATCH net 0/7] net:ethernet:aquantia: Atlantic driver Update 2017-08-23
@ 2017-08-23 14:05 Pavel Belous
2017-08-23 14:05 ` [PATCH net 1/7] net:ethernet:aquantia: Extra spinlocks removed Pavel Belous
` (6 more replies)
0 siblings, 7 replies; 9+ messages in thread
From: Pavel Belous @ 2017-08-23 14:05 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, David Arcari, Igor Russkikh, Nadezhda Krupnina,
Simon Edelhaus, Pavel Belous
From: Pavel Belous <pavel.belous@aquantia.com>
This series contains updates for aQuantia Atlantic driver.
It has bugfixes and some improvements.
Igor Russkikh (1):
net:ethernet:aquantia: Fix for multicast filter handling.
Pavel Belous (6):
net:ethernet:aquantia: Extra spinlocks removed.
net:ethernet:aquantia: Fix for number of RSS queues.
net:ethernet:aquantia: Workaround for HW checksum bug.
net:ethernet:aquantia: Fix for MCP state change.
net:ethernet:aquantia: Fix for incorrect speed index.
net:ethernet:aquantia: Show info message if bad firmware version
detected.
drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 3 +-
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 92 +++++++++++-----------
drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 1 -
drivers/net/ethernet/aquantia/atlantic/aq_utils.h | 1 -
drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 11 +--
.../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 6 ++
.../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 6 ++
.../aquantia/atlantic/hw_atl/hw_atl_utils.c | 17 ++--
.../aquantia/atlantic/hw_atl/hw_atl_utils.h | 16 +++-
9 files changed, 85 insertions(+), 68 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net 1/7] net:ethernet:aquantia: Extra spinlocks removed.
2017-08-23 14:05 [PATCH net 0/7] net:ethernet:aquantia: Atlantic driver Update 2017-08-23 Pavel Belous
@ 2017-08-23 14:05 ` Pavel Belous
2017-08-23 14:05 ` [PATCH net 2/7] net:ethernet:aquantia: Fix for number of RSS queues Pavel Belous
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Pavel Belous @ 2017-08-23 14:05 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, David Arcari, Igor Russkikh, Nadezhda Krupnina,
Simon Edelhaus, Pavel Belous, Pavel Belous
From: Pavel Belous <pavel.belous@aquantia.com>
This patch removes datapath spinlocks which does not perform any
useful work.
Fixes: 6e70637f9f1e ("net: ethernet: aquantia: Add ring support code")
Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 42 +++++++----------------
drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 1 -
drivers/net/ethernet/aquantia/atlantic/aq_utils.h | 1 -
drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 11 ++----
4 files changed, 14 insertions(+), 41 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index 9ee1c50..08b7275 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -597,14 +597,11 @@ static unsigned int aq_nic_map_skb(struct aq_nic_s *self,
}
int aq_nic_xmit(struct aq_nic_s *self, struct sk_buff *skb)
-__releases(&ring->lock)
-__acquires(&ring->lock)
{
struct aq_ring_s *ring = NULL;
unsigned int frags = 0U;
unsigned int vec = skb->queue_mapping % self->aq_nic_cfg.vecs;
unsigned int tc = 0U;
- unsigned int trys = AQ_CFG_LOCK_TRYS;
int err = NETDEV_TX_OK;
bool is_nic_in_bad_state;
@@ -628,36 +625,21 @@ __acquires(&ring->lock)
goto err_exit;
}
- do {
- if (spin_trylock(&ring->header.lock)) {
- frags = aq_nic_map_skb(self, skb, ring);
-
- if (likely(frags)) {
- err = self->aq_hw_ops.hw_ring_tx_xmit(
- self->aq_hw,
- ring, frags);
- if (err >= 0) {
- if (aq_ring_avail_dx(ring) <
- AQ_CFG_SKB_FRAGS_MAX + 1)
- aq_nic_ndev_queue_stop(
- self,
- ring->idx);
-
- ++ring->stats.tx.packets;
- ring->stats.tx.bytes += skb->len;
- }
- } else {
- err = NETDEV_TX_BUSY;
- }
+ frags = aq_nic_map_skb(self, skb, ring);
- spin_unlock(&ring->header.lock);
- break;
- }
- } while (--trys);
+ if (likely(frags)) {
+ err = self->aq_hw_ops.hw_ring_tx_xmit(self->aq_hw,
+ ring,
+ frags);
+ if (err >= 0) {
+ if (aq_ring_avail_dx(ring) < AQ_CFG_SKB_FRAGS_MAX + 1)
+ aq_nic_ndev_queue_stop(self, ring->idx);
- if (!trys) {
+ ++ring->stats.tx.packets;
+ ring->stats.tx.bytes += skb->len;
+ }
+ } else {
err = NETDEV_TX_BUSY;
- goto err_exit;
}
err_exit:
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
index 9a08179..ec5579f 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
@@ -101,7 +101,6 @@ int aq_ring_init(struct aq_ring_s *self)
self->hw_head = 0;
self->sw_head = 0;
self->sw_tail = 0;
- spin_lock_init(&self->header.lock);
return 0;
}
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_utils.h b/drivers/net/ethernet/aquantia/atlantic/aq_utils.h
index f6012b3..e12bcdf 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_utils.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_utils.h
@@ -17,7 +17,6 @@
#define AQ_DIMOF(_ARY_) ARRAY_SIZE(_ARY_)
struct aq_obj_s {
- spinlock_t lock; /* spinlock for nic/rings processing */
atomic_t flags;
};
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
index ad5b4d4d..fee446a 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
@@ -34,8 +34,6 @@ struct aq_vec_s {
#define AQ_VEC_RX_ID 1
static int aq_vec_poll(struct napi_struct *napi, int budget)
-__releases(&self->lock)
-__acquires(&self->lock)
{
struct aq_vec_s *self = container_of(napi, struct aq_vec_s, napi);
struct aq_ring_s *ring = NULL;
@@ -47,7 +45,7 @@ __acquires(&self->lock)
if (!self) {
err = -EINVAL;
- } else if (spin_trylock(&self->header.lock)) {
+ } else {
for (i = 0U, ring = self->ring[0];
self->tx_rings > i; ++i, ring = self->ring[i]) {
if (self->aq_hw_ops->hw_ring_tx_head_update) {
@@ -105,11 +103,8 @@ __acquires(&self->lock)
self->aq_hw_ops->hw_irq_enable(self->aq_hw,
1U << self->aq_ring_param.vec_idx);
}
-
-err_exit:
- spin_unlock(&self->header.lock);
}
-
+err_exit:
return work_done;
}
@@ -185,8 +180,6 @@ int aq_vec_init(struct aq_vec_s *self, struct aq_hw_ops *aq_hw_ops,
self->aq_hw_ops = aq_hw_ops;
self->aq_hw = aq_hw;
- spin_lock_init(&self->header.lock);
-
for (i = 0U, ring = self->ring[0];
self->tx_rings > i; ++i, ring = self->ring[i]) {
err = aq_ring_init(&ring[AQ_VEC_TX_ID]);
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net 2/7] net:ethernet:aquantia: Fix for number of RSS queues.
2017-08-23 14:05 [PATCH net 0/7] net:ethernet:aquantia: Atlantic driver Update 2017-08-23 Pavel Belous
2017-08-23 14:05 ` [PATCH net 1/7] net:ethernet:aquantia: Extra spinlocks removed Pavel Belous
@ 2017-08-23 14:05 ` Pavel Belous
2017-08-23 14:05 ` [PATCH net 3/7] net:ethernet:aquantia: Workaround for HW checksum bug Pavel Belous
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Pavel Belous @ 2017-08-23 14:05 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, David Arcari, Igor Russkikh, Nadezhda Krupnina,
Simon Edelhaus, Pavel Belous, Pavel Belous
From: Pavel Belous <pavel.belous@aquantia.com>
The number of RSS queues should be not more than numbers of CPU.
Its does not make sense to increase perfomance, and also cause problems on
some motherboards.
Fixes: 94f6c9e4cdf6 ("net: ethernet: aquantia: Support for NIC-specific code")
Signed-off-by: Pavel Belous <Pavel.Belous@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 08b7275..d6d8e70 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -103,6 +103,8 @@ int aq_nic_cfg_start(struct aq_nic_s *self)
else
cfg->vecs = 1U;
+ cfg->num_rss_queues = min(cfg->vecs, AQ_CFG_NUM_RSS_QUEUES_DEF);
+
cfg->irq_type = aq_pci_func_get_irq_type(self->aq_pci_func);
if ((cfg->irq_type == AQ_HW_IRQ_LEGACY) ||
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net 3/7] net:ethernet:aquantia: Workaround for HW checksum bug.
2017-08-23 14:05 [PATCH net 0/7] net:ethernet:aquantia: Atlantic driver Update 2017-08-23 Pavel Belous
2017-08-23 14:05 ` [PATCH net 1/7] net:ethernet:aquantia: Extra spinlocks removed Pavel Belous
2017-08-23 14:05 ` [PATCH net 2/7] net:ethernet:aquantia: Fix for number of RSS queues Pavel Belous
@ 2017-08-23 14:05 ` Pavel Belous
2017-08-23 14:05 ` [PATCH net 4/7] net:ethernet:aquantia: Fix for MCP state change Pavel Belous
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Pavel Belous @ 2017-08-23 14:05 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, David Arcari, Igor Russkikh, Nadezhda Krupnina,
Simon Edelhaus, Pavel Belous, Pavel Belous
From: Pavel Belous <pavel.belous@aquantia.com>
The hardware has the HW Checksum Offload bug when small
TCP patckets (with length <= 60 bytes) has wrong "checksum valid" bit.
The solution is - ignore checksum valid bit for small packets
(with length <= 60 bytes) and mark this as CHECKSUM_NONE to allow
network stack recalculate checksum itself.
Fixes: ccf9a5ed14be ("net: ethernet: aquantia: Atlantic A0 and B0 specific functions.")
Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com>
---
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 6 ++++++
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
index faeb493..c5a02df 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
@@ -629,6 +629,12 @@ static int hw_atl_a0_hw_ring_rx_receive(struct aq_hw_s *self,
buff->is_udp_cso = (is_err & 0x10U) ? 0 : 1;
else if (0x0U == (pkt_type & 0x1CU))
buff->is_tcp_cso = (is_err & 0x10U) ? 0 : 1;
+
+ /* Checksum offload workaround for small packets */
+ if (rxd_wb->pkt_len <= 60) {
+ buff->is_ip_cso = 0U;
+ buff->is_cso_err = 0U;
+ }
}
is_err &= ~0x18U;
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
index 1bceb73..21784cc 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
@@ -645,6 +645,12 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self,
buff->is_udp_cso = buff->is_cso_err ? 0U : 1U;
else if (0x0U == (pkt_type & 0x1CU))
buff->is_tcp_cso = buff->is_cso_err ? 0U : 1U;
+
+ /* Checksum offload workaround for small packets */
+ if (rxd_wb->pkt_len <= 60) {
+ buff->is_ip_cso = 0U;
+ buff->is_cso_err = 0U;
+ }
}
is_err &= ~0x18U;
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net 4/7] net:ethernet:aquantia: Fix for MCP state change.
2017-08-23 14:05 [PATCH net 0/7] net:ethernet:aquantia: Atlantic driver Update 2017-08-23 Pavel Belous
` (2 preceding siblings ...)
2017-08-23 14:05 ` [PATCH net 3/7] net:ethernet:aquantia: Workaround for HW checksum bug Pavel Belous
@ 2017-08-23 14:05 ` Pavel Belous
2017-08-24 5:17 ` David Miller
2017-08-23 14:05 ` [PATCH net 5/7] net:ethernet:aquantia: Fix for incorrect speed index Pavel Belous
` (2 subsequent siblings)
6 siblings, 1 reply; 9+ messages in thread
From: Pavel Belous @ 2017-08-23 14:05 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, David Arcari, Igor Russkikh, Nadezhda Krupnina,
Simon Edelhaus, Pavel Belous, Pavel Belous
From: Pavel Belous <pavel.belous@aquantia.com>
The firmware state is controlled by writing value in to 0x368 register.
This value contain MCP state and desired link mode.
Because this value was incorrectly formed the firmware does not
resetting properly (ethtool -S shows the HW counters which
never resetting, even after reboot).
Fixes: 3d2ff7eebe26 "net: ethernet: aquantia: Atlantic hardware abstraction layer")
Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com>
---
.../net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c | 7 ++++---
.../net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h | 13 +++++++++++++
2 files changed, 17 insertions(+), 3 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 8d6d8f5..fcfbe42 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
@@ -280,10 +280,11 @@ err_exit:;
int hw_atl_utils_mpi_set_speed(struct aq_hw_s *self, u32 speed,
enum hal_atl_utils_fw_state_e state)
{
- u32 ucp_0x368 = 0;
+ union hal_atl_utils_hw_mpi_state_reg ucp_0x368 = { 0 };
- ucp_0x368 = (speed << HW_ATL_MPI_SPEED_SHIFT) | state;
- aq_hw_write_reg(self, HW_ATL_MPI_CONTROL_ADR, ucp_0x368);
+ ucp_0x368.u_speed = speed;
+ ucp_0x368.e_state = state;
+ aq_hw_write_reg(self, HW_ATL_MPI_CONTROL_ADR, ucp_0x368.val);
return 0;
}
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 a66aee5..fc69408a 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
@@ -160,6 +160,19 @@ enum hal_atl_utils_fw_state_e {
MPI_POWER = 4,
};
+union hal_atl_utils_hw_mpi_state_reg {
+ u32 val;
+ struct {
+ u8 e_state;
+ u8 reserved1;
+ u8 u_speed;
+ u8 reserved2:1;
+ u8 disable_dirty_wake:1;
+ u8 reserved3:2;
+ u8 u_downshift:4;
+ };
+};
+
#define HAL_ATLANTIC_RATE_10G BIT(0)
#define HAL_ATLANTIC_RATE_5G BIT(1)
#define HAL_ATLANTIC_RATE_5GSR BIT(2)
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net 5/7] net:ethernet:aquantia: Fix for incorrect speed index.
2017-08-23 14:05 [PATCH net 0/7] net:ethernet:aquantia: Atlantic driver Update 2017-08-23 Pavel Belous
` (3 preceding siblings ...)
2017-08-23 14:05 ` [PATCH net 4/7] net:ethernet:aquantia: Fix for MCP state change Pavel Belous
@ 2017-08-23 14:05 ` Pavel Belous
2017-08-23 14:05 ` [PATCH net 6/7] net:ethernet:aquantia: Fix for multicast filter handling Pavel Belous
2017-08-23 14:05 ` [PATCH net 7/7] net:ethernet:aquantia: Show info message if bad firmware version detected Pavel Belous
6 siblings, 0 replies; 9+ messages in thread
From: Pavel Belous @ 2017-08-23 14:05 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, David Arcari, Igor Russkikh, Nadezhda Krupnina,
Simon Edelhaus, Pavel Belous, Pavel Belous
From: Pavel Belous <pavel.belous@aquantia.com>
The driver choose the optimal interrupt throttling settings depends
of current link speed.
Due this bug link_status field from aq_hw is never updated and as result
always used same interrupt throttling values.
Fixes: 3d2ff7eebe26 ("net: ethernet: aquantia: Atlantic hardware abstraction layer")
Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 3 +--
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 31 ++++++++++------------
.../aquantia/atlantic/hw_atl/hw_atl_utils.c | 4 +--
.../aquantia/atlantic/hw_atl/hw_atl_utils.h | 3 +--
4 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
index fce0fd3..bf9b3f0 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
@@ -105,8 +105,7 @@ struct aq_hw_ops {
int (*hw_set_mac_address)(struct aq_hw_s *self, u8 *mac_addr);
- int (*hw_get_link_status)(struct aq_hw_s *self,
- struct aq_hw_link_status_s *link_status);
+ int (*hw_get_link_status)(struct aq_hw_s *self);
int (*hw_set_link_speed)(struct aq_hw_s *self, u32 speed);
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index d6d8e70..dce17a5 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -125,33 +125,30 @@ static void aq_nic_service_timer_cb(unsigned long param)
struct net_device *ndev = aq_nic_get_ndev(self);
int err = 0;
unsigned int i = 0U;
- struct aq_hw_link_status_s link_status;
struct aq_ring_stats_rx_s stats_rx;
struct aq_ring_stats_tx_s stats_tx;
if (aq_utils_obj_test(&self->header.flags, AQ_NIC_FLAGS_IS_NOT_READY))
goto err_exit;
- err = self->aq_hw_ops.hw_get_link_status(self->aq_hw, &link_status);
+ err = self->aq_hw_ops.hw_get_link_status(self->aq_hw);
if (err < 0)
goto err_exit;
- self->aq_hw_ops.hw_interrupt_moderation_set(self->aq_hw,
- self->aq_nic_cfg.is_interrupt_moderation);
-
- if (memcmp(&link_status, &self->link_status, sizeof(link_status))) {
- if (link_status.mbps) {
- aq_utils_obj_set(&self->header.flags,
- AQ_NIC_FLAG_STARTED);
- aq_utils_obj_clear(&self->header.flags,
- AQ_NIC_LINK_DOWN);
- netif_carrier_on(self->ndev);
- } else {
- netif_carrier_off(self->ndev);
- aq_utils_obj_set(&self->header.flags, AQ_NIC_LINK_DOWN);
- }
+ self->link_status = self->aq_hw->aq_link_status;
- self->link_status = link_status;
+ self->aq_hw_ops.hw_interrupt_moderation_set(self->aq_hw,
+ self->aq_nic_cfg.is_interrupt_moderation);
+
+ if (self->link_status.mbps) {
+ aq_utils_obj_set(&self->header.flags,
+ AQ_NIC_FLAG_STARTED);
+ aq_utils_obj_clear(&self->header.flags,
+ AQ_NIC_LINK_DOWN);
+ netif_carrier_on(self->ndev);
+ } else {
+ netif_carrier_off(self->ndev);
+ aq_utils_obj_set(&self->header.flags, AQ_NIC_LINK_DOWN);
}
memset(&stats_rx, 0U, sizeof(struct aq_ring_stats_rx_s));
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 fcfbe42..eb3ae51 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
@@ -314,11 +314,11 @@ void hw_atl_utils_mpi_set(struct aq_hw_s *self,
err_exit:;
}
-int hw_atl_utils_mpi_get_link_status(struct aq_hw_s *self,
- struct aq_hw_link_status_s *link_status)
+int hw_atl_utils_mpi_get_link_status(struct aq_hw_s *self)
{
u32 cp0x036C = aq_hw_read_reg(self, HW_ATL_MPI_STATE_ADR);
u32 link_speed_mask = cp0x036C >> HW_ATL_MPI_SPEED_SHIFT;
+ struct aq_hw_link_status_s *link_status = &self->aq_link_status;
if (!link_speed_mask) {
link_status->mbps = 0U;
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 fc69408a..4f3e148 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
@@ -193,8 +193,7 @@ void hw_atl_utils_mpi_set(struct aq_hw_s *self,
int hw_atl_utils_mpi_set_speed(struct aq_hw_s *self, u32 speed,
enum hal_atl_utils_fw_state_e state);
-int hw_atl_utils_mpi_get_link_status(struct aq_hw_s *self,
- struct aq_hw_link_status_s *link_status);
+int hw_atl_utils_mpi_get_link_status(struct aq_hw_s *self);
int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self,
struct aq_hw_caps_s *aq_hw_caps,
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net 6/7] net:ethernet:aquantia: Fix for multicast filter handling.
2017-08-23 14:05 [PATCH net 0/7] net:ethernet:aquantia: Atlantic driver Update 2017-08-23 Pavel Belous
` (4 preceding siblings ...)
2017-08-23 14:05 ` [PATCH net 5/7] net:ethernet:aquantia: Fix for incorrect speed index Pavel Belous
@ 2017-08-23 14:05 ` Pavel Belous
2017-08-23 14:05 ` [PATCH net 7/7] net:ethernet:aquantia: Show info message if bad firmware version detected Pavel Belous
6 siblings, 0 replies; 9+ messages in thread
From: Pavel Belous @ 2017-08-23 14:05 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, David Arcari, Igor Russkikh, Nadezhda Krupnina,
Simon Edelhaus
From: Igor Russkikh <Igor.Russkikh.aquantia.com>
Since the HW supports up to 32 multicast filters we should
track count of multicast filters to avoid overflow.
If we attempt to add >32 multicast filter - just set NETIF_ALLMULTI flag
instead.
Fixes: 94f6c9e4cdf6 ("net: ethernet: aquantia: Support for NIC-specific code")
Signed-off-by: Igor Russkikh <Igor.Russkikh@aquantia.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index dce17a5..6ac9e26 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -669,11 +669,26 @@ int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev)
netdev_for_each_mc_addr(ha, ndev) {
ether_addr_copy(self->mc_list.ar[i++], ha->addr);
++self->mc_list.count;
+
+ if (i >= AQ_CFG_MULTICAST_ADDRESS_MAX)
+ break;
}
- return self->aq_hw_ops.hw_multicast_list_set(self->aq_hw,
+ if (i >= AQ_CFG_MULTICAST_ADDRESS_MAX) {
+ /* Number of filters is too big: atlantic does not support this.
+ * Force all multi filter to support this.
+ * With this we disable all UC filters and setup "all pass"
+ * multicast mask
+ */
+ self->packet_filter |= IFF_ALLMULTI;
+ self->aq_hw->aq_nic_cfg->mc_list_count = 0;
+ return self->aq_hw_ops.hw_packet_filter_set(self->aq_hw,
+ self->packet_filter);
+ } else {
+ return self->aq_hw_ops.hw_multicast_list_set(self->aq_hw,
self->mc_list.ar,
self->mc_list.count);
+ }
}
int aq_nic_set_mtu(struct aq_nic_s *self, int new_mtu)
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net 7/7] net:ethernet:aquantia: Show info message if bad firmware version detected.
2017-08-23 14:05 [PATCH net 0/7] net:ethernet:aquantia: Atlantic driver Update 2017-08-23 Pavel Belous
` (5 preceding siblings ...)
2017-08-23 14:05 ` [PATCH net 6/7] net:ethernet:aquantia: Fix for multicast filter handling Pavel Belous
@ 2017-08-23 14:05 ` Pavel Belous
6 siblings, 0 replies; 9+ messages in thread
From: Pavel Belous @ 2017-08-23 14:05 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, David Arcari, Igor Russkikh, Nadezhda Krupnina,
Simon Edelhaus, Pavel Belous, Pavel Belous
From: Pavel Belous <pavel.belous@aquantia.com>
We should inform user about wrong firmware version
by printing message in dmesg.
Fixes: 3d2ff7eebe26 ("net: ethernet: aquantia: Atlantic hardware abstraction layer")
Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com>
---
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c | 6 ++++++
1 file changed, 6 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 eb3ae51..ad4cc53 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
@@ -141,6 +141,12 @@ static int hw_atl_utils_init_ucp(struct aq_hw_s *self,
err = hw_atl_utils_ver_match(aq_hw_caps->fw_ver_expected,
aq_hw_read_reg(self, 0x18U));
+
+ if (err < 0)
+ pr_err("%s: Bad FW version detected: expected=%x, actual=%x\n",
+ AQ_CFG_DRV_NAME,
+ aq_hw_caps->fw_ver_expected,
+ aq_hw_read_reg(self, 0x18U));
return err;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net 4/7] net:ethernet:aquantia: Fix for MCP state change.
2017-08-23 14:05 ` [PATCH net 4/7] net:ethernet:aquantia: Fix for MCP state change Pavel Belous
@ 2017-08-24 5:17 ` David Miller
0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2017-08-24 5:17 UTC (permalink / raw)
To: Pavel.Belous
Cc: netdev, darcari, Igor.Russkikh, Nadezhda.Krupnina, simon.edelhaus
From: Pavel Belous <Pavel.Belous@aquantia.com>
Date: Wed, 23 Aug 2017 17:05:05 +0300
> 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 a66aee5..fc69408a 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
> @@ -160,6 +160,19 @@ enum hal_atl_utils_fw_state_e {
> MPI_POWER = 4,
> };
>
> +union hal_atl_utils_hw_mpi_state_reg {
> + u32 val;
> + struct {
> + u8 e_state;
> + u8 reserved1;
> + u8 u_speed;
> + u8 reserved2:1;
> + u8 disable_dirty_wake:1;
> + u8 reserved3:2;
> + u8 u_downshift:4;
> + };
> +};
> +
You need to consider endianness when declaring bitfields in C.
Seriously, I'd rather you simply fixed the shifts and masks into the
u32 value than going down this route.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-08-24 5:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-23 14:05 [PATCH net 0/7] net:ethernet:aquantia: Atlantic driver Update 2017-08-23 Pavel Belous
2017-08-23 14:05 ` [PATCH net 1/7] net:ethernet:aquantia: Extra spinlocks removed Pavel Belous
2017-08-23 14:05 ` [PATCH net 2/7] net:ethernet:aquantia: Fix for number of RSS queues Pavel Belous
2017-08-23 14:05 ` [PATCH net 3/7] net:ethernet:aquantia: Workaround for HW checksum bug Pavel Belous
2017-08-23 14:05 ` [PATCH net 4/7] net:ethernet:aquantia: Fix for MCP state change Pavel Belous
2017-08-24 5:17 ` David Miller
2017-08-23 14:05 ` [PATCH net 5/7] net:ethernet:aquantia: Fix for incorrect speed index Pavel Belous
2017-08-23 14:05 ` [PATCH net 6/7] net:ethernet:aquantia: Fix for multicast filter handling Pavel Belous
2017-08-23 14:05 ` [PATCH net 7/7] net:ethernet:aquantia: Show info message if bad firmware version detected Pavel Belous
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).