net: aquantia: various ethtool ops implementation
Subsystems (3)
v3 cover net: aquantia: various ethtool ops implementation
In this patchset Anton Mikaev and I added some useful ethtool operations:
- ring size changes
- link renegotioation
- flow control management
The patch also improves init/deinit sequence.
V3 changes:
- After review and analysis it is clear that rtnl lock (which is captured by default on ethtool ops) is enough to secure possible overlapping of dev open/close. Thus, just dropping internal mutex.
V2 changes:
- using mutex to secure simultaneous dev close/open
- using state var to store/restore dev state
Igor Russkikh (5):
net: aquantia: Ethtool based ring size configuration
net: aquantia: Improve adapter init/deinit logic
net: aquantia: Implement rx/tx flow control ethtools callback
net: aquantia: Add renegotiate ethtool operation support
net: aquantia: bump driver version
.../net/ethernet/aquantia/atlantic/aq_ethtool.c | 117 +++++++++++++++++++++ drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 20 +++- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 12 ++- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 47 +++++---- .../aquantia/atlantic/hw_atl/hw_atl_a0_internal.h | 8 ++ .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 51 ++++----- .../aquantia/atlantic/hw_atl/hw_atl_b0_internal.h | 8 ++ .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 54 +++++----- .../aquantia/atlantic/hw_atl/hw_atl_utils.h | 35 ++++++ .../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 69 +++++++++++- drivers/net/ethernet/aquantia/atlantic/ver.h | 4 +- 11 files changed, 341 insertions(+), 84 deletions(-)
Signature · 1 line
2.7.4
PATCH v3 1/5 net: aquantia: Ethtool based ring size configuration
From: Anton Mikaev <[email protected]>
Implemented ring size setup, min/max validation and reconfiguration in runtime.
--- .../net/ethernet/aquantia/atlantic/aq_ethtool.c | 61 ++++++++++++++++++++++ drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 9 +++- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 4 +- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 46 ++++++++-------- .../aquantia/atlantic/hw_atl/hw_atl_a0_internal.h | 8 +++ .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 50 +++++++++--------- .../aquantia/atlantic/hw_atl/hw_atl_b0_internal.h | 8 +++ 7 files changed, 136 insertions(+), 50 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +61 -0
@@ -11,6 +11,7 @@#include "aq_ethtool.h" #include "aq_nic.h" +#include "aq_vec.h" static void aq_ethtool_get_regs (struct net_device *ndev,struct ethtool_regs *regs,void *p)
@@ -284,6 +285,64 @@ static int aq_ethtool_set_coalesce(struct net_device *ndev,return aq_nic_update_interrupt_moderation_settings (aq_nic); } +static void aq_get_ringparam (struct net_device *ndev, +struct ethtool_ringparam *ring) +{ +struct aq_nic_s *aq_nic =netdev_priv (ndev); +struct aq_nic_cfg_s *aq_nic_cfg =aq_nic_get_cfg (aq_nic); + + ring->rx_pending = aq_nic_cfg->rxds; + ring->tx_pending = aq_nic_cfg->txds; + + ring->rx_max_pending = aq_nic_cfg->aq_hw_caps->rxds_max; + ring->tx_max_pending = aq_nic_cfg->aq_hw_caps->txds_max; +} + +static int aq_set_ringparam (struct net_device *ndev, +struct ethtool_ringparam *ring) +{ +int err =0 ; +bool ndev_running = false; +struct aq_nic_s *aq_nic =netdev_priv (ndev); +struct aq_nic_cfg_s *aq_nic_cfg =aq_nic_get_cfg (aq_nic); +const struct aq_hw_caps_s *hw_caps = aq_nic_cfg->aq_hw_caps; + +if (ring->rx_mini_pending || ring->rx_jumbo_pending) { + err = -EOPNOTSUPP ; + goto err_exit; + } + +if (netif_running (ndev)) { + ndev_running = true; +dev_close (ndev); + } + +aq_nic_free_vectors (aq_nic); + + aq_nic_cfg->rxds =max (ring->rx_pending, hw_caps->rxds_min); + aq_nic_cfg->rxds =min (aq_nic_cfg->rxds, hw_caps->rxds_max); + aq_nic_cfg->rxds =ALIGN (aq_nic_cfg->rxds,AQ_HW_RXD_MULTIPLE ); + + aq_nic_cfg->txds =max (ring->tx_pending, hw_caps->txds_min); + aq_nic_cfg->txds =min (aq_nic_cfg->txds, hw_caps->txds_max); + aq_nic_cfg->txds =ALIGN (aq_nic_cfg->txds,AQ_HW_TXD_MULTIPLE ); + +for (aq_nic->aq_vecs =0 ; aq_nic->aq_vecs < aq_nic_cfg->vecs; + aq_nic->aq_vecs++) { + aq_nic->aq_vec[aq_nic->aq_vecs] = +aq_vec_alloc (aq_nic, aq_nic->aq_vecs, aq_nic_cfg); +if (unlikely (!aq_nic->aq_vec[aq_nic->aq_vecs])) { + err = -ENOMEM ; + goto err_exit; + } + } +if (ndev_running) + err =dev_open (ndev); + +err_exit: +return err; +} +const struct ethtool_ops aq_ethtool_ops = { .get_link = aq_ethtool_get_link, .get_regs_len = aq_ethtool_get_regs_len,
@@ -291,6 +350,8 @@ const struct ethtool_ops aq_ethtool_ops = { .get_drvinfo = aq_ethtool_get_drvinfo, .get_strings = aq_ethtool_get_strings, .get_rxfh_indir_size = aq_ethtool_get_rss_indir_size, + .get_ringparam = aq_get_ringparam, + .set_ringparam = aq_set_ringparam, .get_rxfh_key_size = aq_ethtool_get_rss_key_size, .get_rxfh = aq_ethtool_get_rss, .get_rxnfc = aq_ethtool_get_rxnfc,
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +7 -2
@@ -24,8 +24,10 @@ struct aq_hw_caps_s {u64 link_speed_msk;unsigned int hw_priv_flags;u32 media_type; -u32 rxds; -u32 txds; +u32 rxds_max; +u32 txds_max; +u32 rxds_min; +u32 txds_min;u32 txhwb_alignment;u32 irq_mask;u32 vecs;
@@ -98,6 +100,9 @@ struct aq_stats_s {#define AQ_HW_MEDIA_TYPE_TP 1U#define AQ_HW_MEDIA_TYPE_FIBRE 2U +#define AQ_HW_TXD_MULTIPLE 8U +#define AQ_HW_RXD_MULTIPLE 8U +struct aq_hw_s {atomic_t flags;u8 rbl_enabled:1 ;
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +2 -2
@@ -89,8 +89,8 @@ void aq_nic_cfg_start(struct aq_nic_s *self)aq_nic_rss_init (self, cfg->num_rss_queues);/*descriptors */ - cfg->rxds =min (cfg->aq_hw_caps->rxds,AQ_CFG_RXDS_DEF ); - cfg->txds =min (cfg->aq_hw_caps->txds,AQ_CFG_TXDS_DEF ); + cfg->rxds =min (cfg->aq_hw_caps->rxds_max,AQ_CFG_RXDS_DEF ); + cfg->txds =min (cfg->aq_hw_caps->txds_max,AQ_CFG_TXDS_DEF );/*rss rings */ cfg->vecs =min (cfg->aq_hw_caps->vecs,AQ_CFG_VECS_DEF );
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c +24 -22
53 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0_internal.h +8 -0
@@ -88,4 +88,12 @@#define HW_ATL_A0_FW_VER_EXPECTED 0x01050006U +#define HW_ATL_A0_MIN_RXD \ + (ALIGN(AQ_CFG_SKB_FRAGS_MAX + 1U, AQ_HW_RXD_MULTIPLE)) +#define HW_ATL_A0_MIN_TXD \ + (ALIGN(AQ_CFG_SKB_FRAGS_MAX + 1U, AQ_HW_TXD_MULTIPLE)) + +#define HW_ATL_A0_MAX_RXD 8184U +#define HW_ATL_A0_MAX_TXD 8184U +#endif /* HW_ATL_A0_INTERNAL_H */
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +26 -24
56 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0_internal.h +8 -0
@@ -142,6 +142,14 @@#define HW_ATL_INTR_MODER_MAX 0x1FF#define HW_ATL_INTR_MODER_MIN 0xFF +#define HW_ATL_B0_MIN_RXD \ + (ALIGN(AQ_CFG_SKB_FRAGS_MAX + 1U, AQ_HW_RXD_MULTIPLE)) +#define HW_ATL_B0_MIN_TXD \ + (ALIGN(AQ_CFG_SKB_FRAGS_MAX + 1U, AQ_HW_TXD_MULTIPLE)) + +#define HW_ATL_B0_MAX_RXD 8184U +#define HW_ATL_B0_MAX_TXD 8184U +/* HW layer capabilities */ #endif /* HW_ATL_B0_INTERNAL_H */
Signature · 1 line
2.7.4
PATCH v3 2/5 net: aquantia: Improve adapter init/deinit logic
In reply to Igor RusskikhWe now pass link drop status to FW on init/deinit. This is required to inform FW that driver took/released a control on link. FW then will manage its own state and device power profile based on this information. To improve management we remove mpi_set function which ambiguously took both state and speed parameters.
Deinit callback is now a part of FW ops, as it actually manages the FW.
--- drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 9 ++-- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 2 +- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 1 - .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 1 - .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 53 ++++++++++++---------- .../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 31 ++++++++++++- 6 files changed, 66 insertions(+), 31 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +6 -3
@@ -202,25 +202,28 @@ struct aq_hw_ops {int (*hw_get_fw_version)(struct aq_hw_s *self,u32 *fw_version); -int (*hw_deinit)(struct aq_hw_s *self); -int (*hw_set_power)(struct aq_hw_s *self,unsigned int power_state); };struct aq_fw_ops {int (*init)(struct aq_hw_s *self); +int (*deinit)(struct aq_hw_s *self); +int (*reset)(struct aq_hw_s *self);int (*get_mac_permanent)(struct aq_hw_s *self,u8 *mac);int (*set_link_speed)(struct aq_hw_s *self,u32 speed); -int (*set_state)(struct aq_hw_s *self,enum hal_atl_utils_fw_state_e state); +int (*set_state)(struct aq_hw_s *self, +enum hal_atl_utils_fw_state_e state);int (*update_link_status)(struct aq_hw_s *self);int (*update_stats)(struct aq_hw_s *self); + +int (*set_flow_control)(struct aq_hw_s *self); };#endif /* AQ_HW_H */
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +1 -1
@@ -879,7 +879,7 @@ void aq_nic_deinit(struct aq_nic_s *self)aq_vec_deinit (aq_vec);if (self->power_state ==AQ_HW_POWER_STATE_D0 ) { - (void )self->aq_hw_ops->hw_deinit (self->aq_hw); + (void )self->aq_fw_ops->deinit (self->aq_hw); }else { (void )self->aq_hw_ops->hw_set_power (self->aq_hw, self->power_state);
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c +0 -1
@@ -877,7 +877,6 @@ static int hw_atl_a0_hw_ring_rx_stop(struct aq_hw_s *self,const struct aq_hw_ops hw_atl_ops_a0 = { .hw_set_mac_address = hw_atl_a0_hw_mac_addr_set, .hw_init = hw_atl_a0_hw_init, - .hw_deinit = hw_atl_utils_hw_deinit, .hw_set_power = hw_atl_utils_hw_set_power, .hw_reset = hw_atl_a0_hw_reset, .hw_start = hw_atl_a0_hw_start,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +0 -1
@@ -935,7 +935,6 @@ static int hw_atl_b0_hw_ring_rx_stop(struct aq_hw_s *self,const struct aq_hw_ops hw_atl_ops_b0 = { .hw_set_mac_address = hw_atl_b0_hw_mac_addr_set, .hw_init = hw_atl_b0_hw_init, - .hw_deinit = hw_atl_utils_hw_deinit, .hw_set_power = hw_atl_utils_hw_set_power, .hw_reset = hw_atl_b0_hw_reset, .hw_start = hw_atl_b0_hw_start,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +29 -24
105 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +30 -1
@@ -28,6 +28,10 @@#define HW_ATL_FW2X_MPI_STATE_ADDR 0x370#define HW_ATL_FW2X_MPI_STATE2_ADDR 0x374 +static int aq_fw2x_set_link_speed (struct aq_hw_s *self,u32 speed); +static int aq_fw2x_set_state (struct aq_hw_s *self, +enum hal_atl_utils_fw_state_e state); +static int aq_fw2x_init (struct aq_hw_s *self) {int err =0 ;
@@ -39,6 +43,16 @@ static int aq_fw2x_init(struct aq_hw_s *self)return err; } +static int aq_fw2x_deinit (struct aq_hw_s *self) +{ +int err =aq_fw2x_set_link_speed (self,0 ); + +if (!err) + err =aq_fw2x_set_state (self,MPI_DEINIT ); + +return err; +} +static enum hw_atl_fw2x_rate link_speed_mask_2fw2x_ratemask (u32 speed) {enum hw_atl_fw2x_rate rate =0 ;
@@ -76,7 +90,21 @@ static int aq_fw2x_set_link_speed(struct aq_hw_s *self, u32 speed)static int aq_fw2x_set_state (struct aq_hw_s *self,enum hal_atl_utils_fw_state_e state) { -/* No explicit state in 2x fw */ +u32 mpi_state =aq_hw_read_reg (self,HW_ATL_FW2X_MPI_CONTROL2_ADDR ); + +switch (state) { +case MPI_INIT : + mpi_state &= ~BIT (CAPS_HI_LINK_DROP ); +break ; +case MPI_DEINIT : + mpi_state |=BIT (CAPS_HI_LINK_DROP ); +break ; +case MPI_RESET : +case MPI_POWER : +/* No actions */ +break ; + } +aq_hw_write_reg (self,HW_ATL_FW2X_MPI_CONTROL2_ADDR , mpi_state);return 0 ; }
@@ -175,6 +203,7 @@ static int aq_fw2x_update_stats(struct aq_hw_s *self)const struct aq_fw_ops aq_fw_2x_ops = { .init = aq_fw2x_init, + .deinit = aq_fw2x_deinit, .reset =NULL , .get_mac_permanent = aq_fw2x_get_mac_permanent, .set_link_speed = aq_fw2x_set_link_speed,
Signature · 1 line
2.7.4
PATCH v3 3/5 net: aquantia: Implement rx/tx flow control ethtools callback
In reply to Igor RusskikhRuntime change of pause frame configuration (rx/tx flow control) via ethtool.
--- .../net/ethernet/aquantia/atlantic/aq_ethtool.c | 42 ++++++++++++++++++++++ drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 6 +++- .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 1 + .../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 26 ++++++++++++++ 4 files changed, 74 insertions(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +42 -0
@@ -285,6 +285,46 @@ static int aq_ethtool_set_coalesce(struct net_device *ndev,return aq_nic_update_interrupt_moderation_settings (aq_nic); } +static void aq_ethtool_get_pauseparam (struct net_device *ndev, +struct ethtool_pauseparam *pause) +{ +struct aq_nic_s *aq_nic =netdev_priv (ndev); + + pause->autoneg =0 ; + +if (aq_nic->aq_hw->aq_nic_cfg->flow_control &AQ_NIC_FC_RX ) + pause->rx_pause =1 ; +if (aq_nic->aq_hw->aq_nic_cfg->flow_control &AQ_NIC_FC_TX ) + pause->tx_pause =1 ; +} + +static int aq_ethtool_set_pauseparam (struct net_device *ndev, +struct ethtool_pauseparam *pause) +{ +struct aq_nic_s *aq_nic =netdev_priv (ndev); +int err =0 ; + +if (!aq_nic->aq_fw_ops->set_flow_control) +return -EOPNOTSUPP ; + +if (pause->autoneg ==AUTONEG_ENABLE ) +return -EOPNOTSUPP ; + +if (pause->rx_pause) + aq_nic->aq_hw->aq_nic_cfg->flow_control |=AQ_NIC_FC_RX ; +else + aq_nic->aq_hw->aq_nic_cfg->flow_control &= ~AQ_NIC_FC_RX ; + +if (pause->tx_pause) + aq_nic->aq_hw->aq_nic_cfg->flow_control |=AQ_NIC_FC_TX ; +else + aq_nic->aq_hw->aq_nic_cfg->flow_control &= ~AQ_NIC_FC_TX ; + + err = aq_nic->aq_fw_ops->set_flow_control (aq_nic->aq_hw); + +return err; +} +static void aq_get_ringparam (struct net_device *ndev,struct ethtool_ringparam *ring) {
@@ -352,6 +392,8 @@ const struct ethtool_ops aq_ethtool_ops = { .get_rxfh_indir_size = aq_ethtool_get_rss_indir_size, .get_ringparam = aq_get_ringparam, .set_ringparam = aq_set_ringparam, + .get_pauseparam = aq_ethtool_get_pauseparam, + .set_pauseparam = aq_ethtool_set_pauseparam, .get_rxfh_key_size = aq_ethtool_get_rss_key_size, .get_rxfh = aq_ethtool_get_rss, .get_rxnfc = aq_ethtool_get_rxnfc,
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +5 -1
@@ -761,10 +761,14 @@ void aq_nic_get_link_ksettings(struct aq_nic_s *self,ethtool_link_ksettings_add_link_mode (cmd, advertising, 100baseT_Full); -if (self->aq_nic_cfg.flow_control) +if (self->aq_nic_cfg.flow_control &AQ_NIC_FC_RX )ethtool_link_ksettings_add_link_mode (cmd, advertising, Pause); +if (self->aq_nic_cfg.flow_control &AQ_NIC_FC_TX ) +ethtool_link_ksettings_add_link_mode (cmd, advertising, + Asym_Pause); +if (self->aq_nic_cfg.aq_hw_caps->media_type ==AQ_HW_MEDIA_TYPE_FIBRE )ethtool_link_ksettings_add_link_mode (cmd, advertising,FIBRE );else
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +1 -0
@@ -834,4 +834,5 @@ const struct aq_fw_ops aq_fw_1x_ops = { .set_state = hw_atl_utils_mpi_set_state, .update_link_status = hw_atl_utils_mpi_get_link_status, .update_stats = hw_atl_utils_update_stats, + .set_flow_control = NULL, };
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +26 -0
@@ -87,6 +87,19 @@ static int aq_fw2x_set_link_speed(struct aq_hw_s *self, u32 speed)return 0 ; } +static void aq_fw2x_set_mpi_flow_control (struct aq_hw_s *self,u32 *mpi_state) +{ +if (self->aq_nic_cfg->flow_control &AQ_NIC_FC_RX ) + *mpi_state |=BIT (CAPS_HI_PAUSE ); +else + *mpi_state &= ~BIT (CAPS_HI_PAUSE ); + +if (self->aq_nic_cfg->flow_control &AQ_NIC_FC_TX ) + *mpi_state |=BIT (CAPS_HI_ASYMMETRIC_PAUSE ); +else + *mpi_state &= ~BIT (CAPS_HI_ASYMMETRIC_PAUSE ); +} +static int aq_fw2x_set_state (struct aq_hw_s *self,enum hal_atl_utils_fw_state_e state) {
@@ -95,6 +108,7 @@ static int aq_fw2x_set_state(struct aq_hw_s *self,switch (state) {case MPI_INIT : mpi_state &= ~BIT (CAPS_HI_LINK_DROP ); +aq_fw2x_set_mpi_flow_control (self, &mpi_state);break ;case MPI_DEINIT : mpi_state |=BIT (CAPS_HI_LINK_DROP );
@@ -201,6 +215,17 @@ static int aq_fw2x_update_stats(struct aq_hw_s *self)return hw_atl_utils_update_stats (self); } +static int aq_fw2x_set_flow_control (struct aq_hw_s *self) +{ +u32 mpi_state =aq_hw_read_reg (self,HW_ATL_FW2X_MPI_CONTROL2_ADDR ); + +aq_fw2x_set_mpi_flow_control (self, &mpi_state); + +aq_hw_write_reg (self,HW_ATL_FW2X_MPI_CONTROL2_ADDR , mpi_state); + +return 0 ; +} +const struct aq_fw_ops aq_fw_2x_ops = { .init = aq_fw2x_init, .deinit = aq_fw2x_deinit,
@@ -210,4 +235,5 @@ const struct aq_fw_ops aq_fw_2x_ops = { .set_state = aq_fw2x_set_state, .update_link_status = aq_fw2x_update_link_status, .update_stats = aq_fw2x_update_stats, + .set_flow_control = aq_fw2x_set_flow_control, };
Signature · 1 line
2.7.4
PATCH v3 4/5 net: aquantia: Add renegotiate ethtool operation support
In reply to Igor RusskikhFrom: Anton Mikaev <[email protected]>
Adds ethtool -r|--negotiate operation support. It triggers special control bit on FW interface causing FW to restart link negotiation.
--- .../net/ethernet/aquantia/atlantic/aq_ethtool.c | 14 +++++++++ drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 2 ++ .../aquantia/atlantic/hw_atl/hw_atl_utils.h | 35 ++++++++++++++++++++++ .../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 12 ++++++++ 4 files changed, 63 insertions(+)
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +14 -0
@@ -285,6 +285,19 @@ static int aq_ethtool_set_coalesce(struct net_device *ndev,return aq_nic_update_interrupt_moderation_settings (aq_nic); } +static int aq_ethtool_nway_reset (struct net_device *ndev) +{ +struct aq_nic_s *aq_nic =netdev_priv (ndev); + +if (unlikely (!aq_nic->aq_fw_ops->renegotiate)) +return -EOPNOTSUPP ; + +if (netif_running (ndev)) +return aq_nic->aq_fw_ops->renegotiate (aq_nic->aq_hw); + +return 0 ; +} +static void aq_ethtool_get_pauseparam (struct net_device *ndev,struct ethtool_pauseparam *pause) {
@@ -390,6 +403,7 @@ const struct ethtool_ops aq_ethtool_ops = { .get_drvinfo = aq_ethtool_get_drvinfo, .get_strings = aq_ethtool_get_strings, .get_rxfh_indir_size = aq_ethtool_get_rss_indir_size, + .nway_reset = aq_ethtool_nway_reset, .get_ringparam = aq_get_ringparam, .set_ringparam = aq_set_ringparam, .get_pauseparam = aq_ethtool_get_pauseparam,
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +2 -0
@@ -212,6 +212,8 @@ struct aq_fw_ops {int (*reset)(struct aq_hw_s *self); +int (*renegotiate)(struct aq_hw_s *self); +int (*get_mac_permanent)(struct aq_hw_s *self,u8 *mac);int (*set_link_speed)(struct aq_hw_s *self,u32 speed);
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h +35 -0
@@ -239,6 +239,41 @@ enum hw_atl_fw2x_caps_hi { CAPS_HI_TRANSACTION_ID, }; +enum hw_atl_fw2x_ctrl { +CTRL_RESERVED1 =0x00 , +CTRL_RESERVED2 , +CTRL_RESERVED3 , +CTRL_PAUSE , +CTRL_ASYMMETRIC_PAUSE , +CTRL_RESERVED4 , +CTRL_RESERVED5 , +CTRL_RESERVED6 , +CTRL_1GBASET_FD_EEE , +CTRL_2P5GBASET_FD_EEE , +CTRL_5GBASET_FD_EEE , +CTRL_10GBASET_FD_EEE , +CTRL_THERMAL_SHUTDOWN , +CTRL_PHY_LOGS , +CTRL_EEE_AUTO_DISABLE , +CTRL_PFC , +CTRL_WAKE_ON_LINK , +CTRL_CABLE_DIAG , +CTRL_TEMPERATURE , +CTRL_DOWNSHIFT , +CTRL_PTP_AVB , +CTRL_RESERVED7 , +CTRL_LINK_DROP , +CTRL_SLEEP_PROXY , +CTRL_WOL , +CTRL_MAC_STOP , +CTRL_EXT_LOOPBACK , +CTRL_INT_LOOPBACK , +CTRL_RESERVED8 , +CTRL_WOL_TIMER , +CTRL_STATISTICS , +CTRL_FORCE_RECONNECT , +}; +struct aq_hw_s ;struct aq_fw_ops ;struct aq_hw_caps_s ;
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +12 -0
@@ -215,6 +215,17 @@ static int aq_fw2x_update_stats(struct aq_hw_s *self)return hw_atl_utils_update_stats (self); } +static int aq_fw2x_renegotiate (struct aq_hw_s *self) +{ +u32 mpi_opts =aq_hw_read_reg (self,HW_ATL_FW2X_MPI_CONTROL2_ADDR ); + + mpi_opts |=BIT (CTRL_FORCE_RECONNECT ); + +aq_hw_write_reg (self,HW_ATL_FW2X_MPI_CONTROL2_ADDR , mpi_opts); + +return 0 ; +} +static int aq_fw2x_set_flow_control (struct aq_hw_s *self) {u32 mpi_state =aq_hw_read_reg (self,HW_ATL_FW2X_MPI_CONTROL2_ADDR );
@@ -230,6 +241,7 @@ const struct aq_fw_ops aq_fw_2x_ops = { .init = aq_fw2x_init, .deinit = aq_fw2x_deinit, .reset = NULL, + .renegotiate = aq_fw2x_renegotiate, .get_mac_permanent = aq_fw2x_get_mac_permanent, .set_link_speed = aq_fw2x_set_link_speed, .set_state = aq_fw2x_set_state,
Signature · 1 line
2.7.4
PATCH v3 5/5 net: aquantia: bump driver version
In reply to Igor Russkikh--- drivers/net/ethernet/aquantia/atlantic/ver.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/aquantia/atlantic/ver.h +2 -2
@@ -12,8 +12,8 @@#define NIC_MAJOR_DRIVER_VERSION 2#define NIC_MINOR_DRIVER_VERSION 0 -#define NIC_BUILD_DRIVER_VERSION 2 -#define NIC_REVISION_DRIVER_VERSION 1 +#define NIC_BUILD_DRIVER_VERSION 3 +#define NIC_REVISION_DRIVER_VERSION 0#define AQ_CFG_DRV_VERSION_SUFFIX "-kern"
Signature · 1 line
2.7.4
David Miller
maintainerFrom: Igor Russkikh <[email protected]>
Date: Mon, 2 Jul 2018 17:03:34 +0300
Quoted 7 lines
In this patchset Anton Mikaev and I added some useful ethtool operations:
- ring size changes
- link renegotioation
- flow control managementThe patch also improves init/deinit sequence.
Quoted 8 lines
V3 changes:
- After review and analysis it is clear that rtnl lock (which is captured by default on ethtool ops) is enough to secure possible overlapping of dev open/close. Thus, just dropping internal mutex.V2 changes:
- using mutex to secure simultaneous dev close/open
- using state var to store/restore dev state
Series applied.