net: atlantic: additional A2 features
Subsystems (3)
cover net: atlantic: additional A2 features
This patchset adds more features to A2:
* half duplex rates;
* EEE;
* flow control;
* link partner capabilities reporting;
* phy loopback.
Feature-wise A2 is almost on-par with A1 save for WoL and filtering, which will be submitted as separate follow-up patchset(s).
Dmitry Bogdanov (2):
net: atlantic: A2: report link partner capabilities
net: atlantic: A2: phy loopback support
Igor Russkikh (2):
net: atlantic: A2: half duplex support
net: atlantic: A2: flow control support
Nikita Danilov (2):
net: atlantic: remove baseX usage
net: atlantic: A2: EEE support
.../ethernet/aquantia/atlantic/aq_common.h | 18 +- .../ethernet/aquantia/atlantic/aq_ethtool.c | 19 +- .../net/ethernet/aquantia/atlantic/aq_hw.h | 10 +- .../net/ethernet/aquantia/atlantic/aq_nic.c | 109 +++++++++-- .../aquantia/atlantic/hw_atl/hw_atl_b0.c | 4 +- .../aquantia/atlantic/hw_atl/hw_atl_b0.h | 3 + .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 1 + .../atlantic/hw_atl/hw_atl_utils_fw2x.c | 1 + .../aquantia/atlantic/hw_atl2/hw_atl2.c | 9 +- .../atlantic/hw_atl2/hw_atl2_utils_fw.c | 174 ++++++++++++++++++ 10 files changed, 313 insertions(+), 35 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/6 net: atlantic: A2: half duplex support
This patch adds support for 10M/100M/1G half duplex rates, which are supported by A2 in additional to full duplex rates supported by A1.
--- .../ethernet/aquantia/atlantic/aq_common.h | 13 ++-- .../net/ethernet/aquantia/atlantic/aq_hw.h | 8 ++- .../net/ethernet/aquantia/atlantic/aq_nic.c | 60 ++++++++++++++----- .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 1 + .../atlantic/hw_atl/hw_atl_utils_fw2x.c | 1 + .../aquantia/atlantic/hw_atl2/hw_atl2.c | 5 +- .../atlantic/hw_atl2/hw_atl2_utils_fw.c | 5 ++ 7 files changed, 70 insertions(+), 23 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_common.h +8 -5
@@ -58,11 +58,14 @@#define AQ_NIC_RATE_1G BIT(4)#define AQ_NIC_RATE_100M BIT(5)#define AQ_NIC_RATE_10M BIT(6) +#define AQ_NIC_RATE_1G_HALF BIT(7) +#define AQ_NIC_RATE_100M_HALF BIT(8) +#define AQ_NIC_RATE_10M_HALF BIT(9) -#define AQ_NIC_RATE_EEE_10G BIT(7) -#define AQ_NIC_RATE_EEE_5G BIT(8) -#define AQ_NIC_RATE_EEE_2G5 BIT(9) -#define AQ_NIC_RATE_EEE_1G BIT(10) -#define AQ_NIC_RATE_EEE_100M BIT(11) +#define AQ_NIC_RATE_EEE_10G BIT(10) +#define AQ_NIC_RATE_EEE_5G BIT(11) +#define AQ_NIC_RATE_EEE_2G5 BIT(12) +#define AQ_NIC_RATE_EEE_1G BIT(13) +#define AQ_NIC_RATE_EEE_100M BIT(14)#endif /* AQ_COMMON_H */
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +5 -3
@@ -1,7 +1,8 @@/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* aQuantia Corporation Network Driver -* Copyright (C) 2014-2019 aQuantia Corporation. All rights reserved +/* Atlantic Network Driver +* +* Copyright (C) 2014-2019 aQuantia Corporation +* Copyright (C) 2019-2020 Marvell International Ltd. */ /* File aq_hw.h: Declaration of abstract interface for NIC hardware specific
@@ -69,6 +70,7 @@ struct aq_hw_caps_s {struct aq_hw_link_status_s {unsigned int mbps; +bool full_duplex; };struct aq_stats_s {
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +46 -14
125 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +1 -0
@@ -704,6 +704,7 @@ int hw_atl_utils_mpi_get_link_status(struct aq_hw_s *self)return -EBUSY ; } } + link_status->full_duplex = true;return 0 ; }
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +1 -0
@@ -274,6 +274,7 @@ static int aq_fw2x_update_link_status(struct aq_hw_s *self) }else { link_status->mbps =0 ; } + link_status->full_duplex = true;return 0 ; }
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c +4 -1
@@ -64,8 +64,11 @@ const struct aq_hw_caps_s hw_atl2_caps_aqc113 = {AQ_NIC_RATE_5G |AQ_NIC_RATE_2G5 |AQ_NIC_RATE_1G | +AQ_NIC_RATE_1G_HALF |AQ_NIC_RATE_100M | - AQ_NIC_RATE_10M, +AQ_NIC_RATE_100M_HALF | +AQ_NIC_RATE_10M | + AQ_NIC_RATE_10M_HALF, };static u32 hw_atl2_sem_act_rslvr_get (struct aq_hw_s *self)
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c +5 -0
@@ -135,6 +135,10 @@ static void a2_link_speed_mask2fw(u32 speed, link_options->rate_1G = !!(speed &AQ_NIC_RATE_1G ); link_options->rate_100M = !!(speed &AQ_NIC_RATE_100M ); link_options->rate_10M = !!(speed &AQ_NIC_RATE_10M ); + + link_options->rate_1G_hd = !!(speed &AQ_NIC_RATE_1G_HALF ); + link_options->rate_100M_hd = !!(speed &AQ_NIC_RATE_100M_HALF ); + link_options->rate_10M_hd = !!(speed &AQ_NIC_RATE_10M_HALF ); }static int aq_a2_fw_set_link_speed (struct aq_hw_s *self,u32 speed)
@@ -202,6 +206,7 @@ static int aq_a2_fw_update_link_status(struct aq_hw_s *self)default : self->aq_link_status.mbps =0 ; } + self->aq_link_status.full_duplex = link_status.duplex;return 0 ; }
Signature · 1 line
2.25.1
PATCH 2/6 net: atlantic: remove baseX usage
In reply to Igor RusskikhFrom: Nikita Danilov <[email protected]>
This patch removes 2.5G baseX wrong usage/reporting, since it shouldn't have been mixed with baseT.
--- drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +0 -3
@@ -618,9 +618,6 @@ static enum hw_atl_fw2x_rate eee_mask_to_ethtool_mask(u32 speed)if (speed &AQ_NIC_RATE_EEE_10G ) rate |= SUPPORTED_10000baseT_Full; -if (speed &AQ_NIC_RATE_EEE_2G5 ) - rate |= SUPPORTED_2500baseX_Full; -if (speed &AQ_NIC_RATE_EEE_1G ) rate |= SUPPORTED_1000baseT_Full;
Signature · 1 line
2.25.1
PATCH 3/6 net: atlantic: A2: EEE support
In reply to Igor RusskikhFrom: Nikita Danilov <[email protected]>
This patch adds EEE support on A2.
--- .../ethernet/aquantia/atlantic/aq_common.h | 5 ++ .../ethernet/aquantia/atlantic/aq_ethtool.c | 11 +-- .../atlantic/hw_atl2/hw_atl2_utils_fw.c | 80 +++++++++++++++++++ 3 files changed, 91 insertions(+), 5 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_common.h +5 -0
@@ -67,5 +67,10 @@#define AQ_NIC_RATE_EEE_2G5 BIT(12)#define AQ_NIC_RATE_EEE_1G BIT(13)#define AQ_NIC_RATE_EEE_100M BIT(14) +#define AQ_NIC_RATE_EEE_MSK (AQ_NIC_RATE_EEE_10G |\ + AQ_NIC_RATE_EEE_5G |\ + AQ_NIC_RATE_EEE_2G5 |\ + AQ_NIC_RATE_EEE_1G |\ + AQ_NIC_RATE_EEE_100M)#endif /* AQ_COMMON_H */
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +6 -5
@@ -1,7 +1,8 @@// SPDX-License-Identifier: GPL-2.0-only -/* -* aQuantia Corporation Network Driver -* Copyright (C) 2014-2019 aQuantia Corporation. All rights reserved +/* Atlantic Network Driver +* +* Copyright (C) 2014-2019 aQuantia Corporation +* Copyright (C) 2019-2020 Marvell International Ltd. */ /* File aq_ethtool.c: Definition of ethertool related functions. */
@@ -611,7 +612,7 @@ static int aq_ethtool_get_ts_info(struct net_device *ndev,return 0 ; } -static enum hw_atl_fw2x_rate eee_mask_to_ethtool_mask (u32 speed) +static u32 eee_mask_to_ethtool_mask (u32 speed) {u32 rate =0 ;
@@ -653,7 +654,7 @@ static int aq_ethtool_get_eee(struct net_device *ndev, struct ethtool_eee *eee) eee->eee_enabled = !!eee->advertised; eee->tx_lpi_enabled = eee->eee_enabled; -if (eee->advertised & eee->lp_advertised) +if ((supported_rates & rate) &AQ_NIC_RATE_EEE_MSK ) eee->eee_active = true;return 0 ;
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c +80 -0
114 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 4/6 net: atlantic: A2: flow control support
In reply to Igor RusskikhThis patch adds flow control support on A2.
--- .../aquantia/atlantic/hw_atl/hw_atl_b0.c | 2 +- .../aquantia/atlantic/hw_atl/hw_atl_b0.h | 2 ++ .../aquantia/atlantic/hw_atl2/hw_atl2.c | 3 ++ .../atlantic/hw_atl2/hw_atl2_utils_fw.c | 36 +++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +1 -1
@@ -108,7 +108,7 @@ static int hw_atl_b0_hw_reset(struct aq_hw_s *self)return err; } -static int hw_atl_b0_set_fc (struct aq_hw_s *self,u32 fc,u32 tc) +int hw_atl_b0_set_fc (struct aq_hw_s *self,u32 fc,u32 tc) {hw_atl_rpb_rx_xoff_en_per_tc_set (self, !!(fc &AQ_NIC_FC_RX ), tc);
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h +2 -0
@@ -62,6 +62,8 @@ void hw_atl_b0_hw_init_rx_rss_ctrl1(struct aq_hw_s *self);int hw_atl_b0_hw_mac_addr_set (struct aq_hw_s *self,u8 *mac_addr); +int hw_atl_b0_set_fc (struct aq_hw_s *self,u32 fc,u32 tc); +int hw_atl_b0_hw_start (struct aq_hw_s *self);int hw_atl_b0_hw_irq_enable (struct aq_hw_s *self,u64 mask);
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c +3 -0
@@ -181,6 +181,8 @@ static int hw_atl2_hw_qos_set(struct aq_hw_s *self) threshold = (rx_buff_size * (1024U /32U ) *50U ) /100U ;hw_atl_rpb_rx_buff_lo_threshold_per_tc_set (self, threshold, tc); + +hw_atl_b0_set_fc (self, self->aq_nic_cfg->fc.req, tc); }/* QoS 802.1p priority -> TC mapping */
@@ -841,4 +843,5 @@ const struct aq_hw_ops hw_atl2_ops = { .hw_get_hw_stats = hw_atl2_utils_get_hw_stats, .hw_get_fw_version = hw_atl2_utils_get_fw_version, .hw_set_offload = hw_atl_b0_hw_offload_set, + .hw_set_fc = hw_atl_b0_set_fc, };
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c +36 -0
@@ -190,6 +190,15 @@ static int aq_a2_fw_set_link_speed(struct aq_hw_s *self, u32 speed)return hw_atl2_shared_buffer_finish_ack (self); } +static void aq_a2_fw_set_mpi_flow_control (struct aq_hw_s *self, +struct link_options_s *link_options) +{ +u32 flow_control = self->aq_nic_cfg->fc.req; + + link_options->pause_rx = !!(flow_control &AQ_NIC_FC_RX ); + link_options->pause_tx = !!(flow_control &AQ_NIC_FC_TX ); +} +static void aq_a2_fw_upd_eee_rate_bits (struct aq_hw_s *self,struct link_options_s *link_options,u32 eee_speeds)
@@ -213,6 +222,7 @@ static int aq_a2_fw_set_state(struct aq_hw_s *self, link_options.link_up =1U ;aq_a2_fw_upd_eee_rate_bits (self, &link_options, self->aq_nic_cfg->eee_speeds); +aq_a2_fw_set_mpi_flow_control (self, &link_options);break ;case MPI_DEINIT : link_options.link_up =0U ;
@@ -363,6 +373,30 @@ static int aq_a2_fw_renegotiate(struct aq_hw_s *self)return err; } +static int aq_a2_fw_set_flow_control (struct aq_hw_s *self) +{ +struct link_options_s link_options; + +hw_atl2_shared_buffer_get (self, link_options, link_options); + +aq_a2_fw_set_mpi_flow_control (self, &link_options); + +hw_atl2_shared_buffer_write (self, link_options, link_options); + +return hw_atl2_shared_buffer_finish_ack (self); +} + +static u32 aq_a2_fw_get_flow_control (struct aq_hw_s *self,u32 *fcmode) +{ +struct link_status_s link_status; + +hw_atl2_shared_buffer_read (self, link_status, link_status); + + *fcmode = ((link_status.pause_rx) ?AQ_NIC_FC_RX :0 ) | + ((link_status.pause_tx) ?AQ_NIC_FC_TX :0 ); +return 0 ; +} +u32 hw_atl2_utils_get_fw_version (struct aq_hw_s *self) {struct version_s version;
@@ -402,4 +436,6 @@ const struct aq_fw_ops aq_a2_fw_ops = { .update_stats = aq_a2_fw_update_stats, .set_eee_rate = aq_a2_fw_set_eee_rate, .get_eee_rate = aq_a2_fw_get_eee_rate, + .set_flow_control = aq_a2_fw_set_flow_control, + .get_flow_control = aq_a2_fw_get_flow_control, };
Signature · 1 line
2.25.1
PATCH 5/6 net: atlantic: A2: report link partner capabilities
In reply to Igor RusskikhFrom: Dmitry Bogdanov <[email protected]>
This patch adds link partner capabilities reporting support on A2. In particular, the following capabilities are available for reporting:
* link rate;
* EEE;
* flow control.
--- .../net/ethernet/aquantia/atlantic/aq_hw.h | 2 + .../net/ethernet/aquantia/atlantic/aq_nic.c | 49 +++++++++++++++++++ .../atlantic/hw_atl2/hw_atl2_utils_fw.c | 30 ++++++++++++ 3 files changed, 81 insertions(+)
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +2 -0
@@ -71,6 +71,8 @@ struct aq_hw_caps_s {struct aq_hw_link_status_s {unsigned int mbps;bool full_duplex; +u32 lp_link_speed_msk; +u32 lp_flow_control; };struct aq_stats_s {
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +49 -0
61 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c +30 -0
@@ -164,6 +164,27 @@ static u32 a2_fw_lkp_to_mask(struct lkp_link_caps_s *lkp_link_caps) {u32 rate =0 ; +if (lkp_link_caps->rate_10G) + rate |=AQ_NIC_RATE_10G ; +if (lkp_link_caps->rate_5G) + rate |=AQ_NIC_RATE_5G ; +if (lkp_link_caps->rate_N5G) + rate |=AQ_NIC_RATE_5GSR ; +if (lkp_link_caps->rate_2P5G) + rate |=AQ_NIC_RATE_2G5 ; +if (lkp_link_caps->rate_1G) + rate |=AQ_NIC_RATE_1G ; +if (lkp_link_caps->rate_1G_hd) + rate |=AQ_NIC_RATE_1G_HALF ; +if (lkp_link_caps->rate_100M) + rate |=AQ_NIC_RATE_100M ; +if (lkp_link_caps->rate_100M_hd) + rate |=AQ_NIC_RATE_100M_HALF ; +if (lkp_link_caps->rate_10M) + rate |=AQ_NIC_RATE_10M ; +if (lkp_link_caps->rate_10M_hd) + rate |=AQ_NIC_RATE_10M_HALF ; +if (lkp_link_caps->eee_10G) rate |=AQ_NIC_RATE_EEE_10G ;if (lkp_link_caps->eee_5G)
@@ -240,6 +261,7 @@ static int aq_a2_fw_set_state(struct aq_hw_s *self,static int aq_a2_fw_update_link_status (struct aq_hw_s *self) { +struct lkp_link_caps_s lkp_link_caps;struct link_status_s link_status;hw_atl2_shared_buffer_read (self, link_status, link_status);
@@ -268,6 +290,14 @@ static int aq_a2_fw_update_link_status(struct aq_hw_s *self) } self->aq_link_status.full_duplex = link_status.duplex; +hw_atl2_shared_buffer_read (self, lkp_link_caps, lkp_link_caps); + + self->aq_link_status.lp_link_speed_msk = +a2_fw_lkp_to_mask (&lkp_link_caps); + self->aq_link_status.lp_flow_control = + ((lkp_link_caps.pause_rx) ?AQ_NIC_FC_RX :0 ) | + ((lkp_link_caps.pause_tx) ?AQ_NIC_FC_TX :0 ); +return 0 ; }
Signature · 1 line
2.25.1
PATCH 6/6 net: atlantic: A2: phy loopback support
In reply to Igor RusskikhFrom: Dmitry Bogdanov <[email protected]>
This patch adds the phy loopback support on A2.
--- .../ethernet/aquantia/atlantic/aq_ethtool.c | 5 ++-- .../aquantia/atlantic/hw_atl/hw_atl_b0.c | 2 +- .../aquantia/atlantic/hw_atl/hw_atl_b0.h | 1 + .../aquantia/atlantic/hw_atl2/hw_atl2.c | 1 + .../atlantic/hw_atl2/hw_atl2_utils_fw.c | 23 +++++++++++++++++++ 5 files changed, 29 insertions(+), 3 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +3 -2
@@ -836,6 +836,7 @@ static int aq_ethtool_set_priv_flags(struct net_device *ndev, u32 flags)struct aq_nic_s *aq_nic =netdev_priv (ndev);struct aq_nic_cfg_s *cfg;u32 priv_flags; +int ret =0 ; cfg =aq_nic_get_cfg (aq_nic); priv_flags = cfg->priv_flags;
@@ -857,10 +858,10 @@ static int aq_ethtool_set_priv_flags(struct net_device *ndev, u32 flags)dev_open (ndev,NULL ); } }else if ((priv_flags ^ flags) &AQ_HW_LOOPBACK_MASK ) { -aq_nic_set_loopback (aq_nic); + ret =aq_nic_set_loopback (aq_nic); } -return 0 ; +return ret; }const struct ethtool_ops aq_ethtool_ops = {
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +1 -1
@@ -1556,7 +1556,7 @@ static int hw_atl_b0_hw_vlan_ctrl(struct aq_hw_s *self, bool enable)return aq_hw_err_from_flags (self); } -static int hw_atl_b0_set_loopback (struct aq_hw_s *self,u32 mode,bool enable) +int hw_atl_b0_set_loopback (struct aq_hw_s *self,u32 mode,bool enable) {switch (mode) {case AQ_HW_LOOPBACK_DMA_SYS :
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h +1 -0
@@ -63,6 +63,7 @@ void hw_atl_b0_hw_init_rx_rss_ctrl1(struct aq_hw_s *self);int hw_atl_b0_hw_mac_addr_set (struct aq_hw_s *self,u8 *mac_addr);int hw_atl_b0_set_fc (struct aq_hw_s *self,u32 fc,u32 tc); +int hw_atl_b0_set_loopback (struct aq_hw_s *self,u32 mode,bool enable);int hw_atl_b0_hw_start (struct aq_hw_s *self);
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c +1 -0
@@ -843,5 +843,6 @@ const struct aq_hw_ops hw_atl2_ops = { .hw_get_hw_stats = hw_atl2_utils_get_hw_stats, .hw_get_fw_version = hw_atl2_utils_get_fw_version, .hw_set_offload = hw_atl_b0_hw_offload_set, + .hw_set_loopback = hw_atl_b0_set_loopback, .hw_set_fc = hw_atl_b0_set_fc, };
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c +23 -0
@@ -427,6 +427,28 @@ static u32 aq_a2_fw_get_flow_control(struct aq_hw_s *self, u32 *fcmode)return 0 ; } +static int aq_a2_fw_set_phyloopback (struct aq_hw_s *self,u32 mode,bool enable) +{ +struct link_options_s link_options; + +hw_atl2_shared_buffer_get (self, link_options, link_options); + +switch (mode) { +case AQ_HW_LOOPBACK_PHYINT_SYS : + link_options.internal_loopback = enable; +break ; +case AQ_HW_LOOPBACK_PHYEXT_SYS : + link_options.external_loopback = enable; +break ; +default : +return -EINVAL ; + } + +hw_atl2_shared_buffer_write (self, link_options, link_options); + +return hw_atl2_shared_buffer_finish_ack (self); +} +u32 hw_atl2_utils_get_fw_version (struct aq_hw_s *self) {struct version_s version;
@@ -468,4 +490,5 @@ const struct aq_fw_ops aq_a2_fw_ops = { .get_eee_rate = aq_a2_fw_get_eee_rate, .set_flow_control = aq_a2_fw_set_flow_control, .get_flow_control = aq_a2_fw_get_flow_control, + .set_phyloopback = aq_a2_fw_set_phyloopback, };
Signature · 1 line
2.25.1
Quoted 9 lines · On Mon, 22 Jun 2020 17:53:03 +0300 Igor Russkikh wrote:
This patchset adds more features to A2:
* half duplex rates;
* EEE;
* flow control;
* link partner capabilities reporting;
* phy loopback.Feature-wise A2 is almost on-par with A1 save for WoL and filtering, which will be submitted as separate follow-up patchset(s)
David Miller
maintainerFrom: Igor Russkikh <[email protected]>
Date: Mon, 22 Jun 2020 17:53:03 +0300
Quoted 9 lines
This patchset adds more features to A2:
* half duplex rates;
* EEE;
* flow control;
* link partner capabilities reporting;
* phy loopback.Feature-wise A2 is almost on-par with A1 save for WoL and filtering, which will be submitted as separate follow-up patchset(s).
Series applied, thank you.