net: aquantia: implement WOL and EEE support
Subsystems (3)
cover net: aquantia: implement WOL and EEE support
In this patchset Yana Esina and Nikita Danilov implemented:
- Upload function to interact with FW memory
- Definitions and structures necessary for the correct operation of Wake ON Lan
- The functionality Wake On Lan via ethtool (Magic packet is supported)
- The functionality for Energy-Efficient Ethernet configuration via ethtool
Igor Russkikh (1):
net: aquantia: bump driver version
Yana Esina (4):
net: aquantia: fix hw_atl_utils_fw_upload_dwords
net: aquantia: definitions for WOL patch
net: aquantia: implement WOL support
net: aquantia: implement EEE support
drivers/net/ethernet/aquantia/atlantic/aq_common.h | 5 + .../net/ethernet/aquantia/atlantic/aq_ethtool.c | 108 ++++++++ drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 13 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 12 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 4 + .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 33 ++- .../aquantia/atlantic/hw_atl/hw_atl_a0_internal.h | 6 - .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 35 ++- .../aquantia/atlantic/hw_atl/hw_atl_b0_internal.h | 6 - .../ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c | 7 + .../ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h | 3 + .../aquantia/atlantic/hw_atl/hw_atl_llh_internal.h | 13 + .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 134 ++++++++-- .../aquantia/atlantic/hw_atl/hw_atl_utils.h | 127 +++++++++- .../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 277 +++++++++++++++++++-- drivers/net/ethernet/aquantia/atlantic/ver.h | 2 +- 16 files changed, 665 insertions(+), 120 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/5 net: aquantia: fix hw_atl_utils_fw_upload_dwords
From: Yana Esina <[email protected]>
This patch fixes the upload function, which worked incorrectly with some chips.
--- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c | 7 ++++ .../ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h | 3 ++ .../aquantia/atlantic/hw_atl/hw_atl_llh_internal.h | 13 +++++++ .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 44 ++++++++++++++-------- .../aquantia/atlantic/hw_atl/hw_atl_utils.h | 6 +++ .../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 7 +++- 6 files changed, 64 insertions(+), 16 deletions(-)
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c +7 -0
@@ -1460,3 +1460,10 @@ void hw_atl_reg_glb_cpu_scratch_scp_set(struct aq_hw_s *aq_hw,aq_hw_write_reg (aq_hw,HW_ATL_GLB_CPU_SCRATCH_SCP_ADR (scratch_scp), glb_cpu_scratch_scp); } + +void hw_atl_mcp_up_force_intr_set (struct aq_hw_s *aq_hw,u32 up_force_intr) +{ +aq_hw_write_reg_bit (aq_hw,HW_ATL_MCP_UP_FORCE_INTERRUPT_ADR , +HW_ATL_MCP_UP_FORCE_INTERRUPT_MSK , +HW_ATL_MCP_UP_FORCE_INTERRUPT_SHIFT , up_force_intr); +}
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h +3 -0
@@ -698,4 +698,7 @@ void hw_atl_msm_reg_wr_strobe_set(struct aq_hw_s *aq_hw, u32 reg_wr_strobe);/* set pci register reset disable */ void hw_atl_pci_pci_reg_res_dis_set (struct aq_hw_s *aq_hw,u32 pci_reg_res_dis); +/* set uP Force Interrupt */ +void hw_atl_mcp_up_force_intr_set (struct aq_hw_s *aq_hw,u32 up_force_intr); +#endif /* HW_ATL_LLH_H */
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h +13 -0
@@ -2387,4 +2387,17 @@#define HW_ATL_GLB_CPU_SCRATCH_SCP_ADR (scratch_scp) \ (0x00000300u + (scratch_scp) * 0x4) +/* register address for bitfield uP Force Interrupt */ +#define HW_ATL_MCP_UP_FORCE_INTERRUPT_ADR 0x00000404 +/* bitmask for bitfield uP Force Interrupt */ +#define HW_ATL_MCP_UP_FORCE_INTERRUPT_MSK 0x00000002 +/* inverted bitmask for bitfield uP Force Interrupt */ +#define HW_ATL_MCP_UP_FORCE_INTERRUPT_MSKN 0xFFFFFFFD +/* lower bit position of bitfield uP Force Interrupt */ +#define HW_ATL_MCP_UP_FORCE_INTERRUPT_SHIFT 1 +/* width of bitfield uP Force Interrupt */ +#define HW_ATL_MCP_UP_FORCE_INTERRUPT_WIDTH 1 +/* default value of bitfield uP Force Interrupt */ +#define HW_ATL_MCP_UP_FORCE_INTERRUPT_DEFAULT 0x0 +#endif /* HW_ATL_LLH_INTERNAL_H */
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +29 -15
78 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h +6 -0
@@ -316,9 +316,15 @@ int hw_atl_utils_get_fw_version(struct aq_hw_s *self, u32 *fw_version);int hw_atl_utils_update_stats (struct aq_hw_s *self);struct aq_stats_s *hw_atl_utils_get_hw_stats (struct aq_hw_s *self); +int hw_atl_utils_fw_downld_dwords (struct aq_hw_s *self,u32 a,u32 *p,u32 cnt); +int hw_atl_utils_fw_rpc_call (struct aq_hw_s *self,unsigned int rpc_size); + +int hw_atl_utils_fw_rpc_wait (struct aq_hw_s *self, +struct hw_aq_atl_utils_fw_rpc **rpc); +extern const struct aq_fw_ops aq_fw_1x_ops;extern const struct aq_fw_ops aq_fw_2x_ops;
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +6 -1
@@ -21,6 +21,7 @@#define HW_ATL_FW2X_MPI_EFUSE_ADDR 0x364#define HW_ATL_FW2X_MPI_MBOX_ADDR 0x360 +#define HW_ATL_FW2X_MPI_RPC_ADDR 0x334#define HW_ATL_FW2X_MPI_CONTROL_ADDR 0x368#define HW_ATL_FW2X_MPI_CONTROL2_ADDR 0x36C
@@ -38,8 +39,12 @@ static int aq_fw2x_init(struct aq_hw_s *self)/* check 10 times by 1ms */ AQ_HW_WAIT_FOR (0U != (self->mbox_addr = -aq_hw_read_reg (self,HW_ATL_FW2X_MPI_MBOX_ADDR )), +aq_hw_read_reg (self,HW_ATL_FW2X_MPI_MBOX_ADDR )),1000U ,10U ); +AQ_HW_WAIT_FOR (0U != (self->rpc_addr = +aq_hw_read_reg (self,HW_ATL_FW2X_MPI_RPC_ADDR )), +1000U ,100U ); +return err; }
Signature · 1 line
2.7.4
Re: [PATCH net-next 1/5] net: aquantia: fix hw_atl_utils_fw_upload_dwords
Quoted 4 lines · Igor Russkikh
From: Yana Esina <[email protected]>
This patch fixes the upload function, which worked incorrectly with some chips.
Hi Igor
This patch contains a few whitespace changes. It is normal to put them into a separate patch.
Thanks
Andrew
PATCH 2/5 net: aquantia: definitions for WOL patch
In reply to Igor RusskikhFrom: Yana Esina <[email protected]>
Added definitions and structures needed to support WOL.
--- drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 4 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 3 + .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 10 +- .../aquantia/atlantic/hw_atl/hw_atl_utils.h | 108 ++++++++++++++++++--- .../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 32 ++++++ 5 files changed, 138 insertions(+), 19 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +2 -2
@@ -112,7 +112,7 @@ struct aq_hw_s {const struct aq_fw_ops *aq_fw_ops;void __iomem *mmio;struct aq_hw_link_status_s aq_link_status; -struct hw_aq_atl_utils_mbox mbox; +struct hw_atl_utils_mbox mbox;struct hw_atl_stats_s last_stats;struct aq_stats_s curr_stats;u64 speed;
@@ -124,7 +124,7 @@ struct aq_hw_s {u32 mbox_addr;u32 rpc_addr;u32 rpc_tid; -struct hw_aq_atl_utils_fw_rpc rpc; +struct hw_atl_utils_fw_rpc rpc; };struct aq_ring_s ;
drivers/net/ethernet/aquantia/atlantic/aq_nic.h +3 -0
@@ -36,6 +36,7 @@ struct aq_nic_cfg_s {u32 flow_control;u32 link_speed_msk;u32 vlan_id; +u32 wol;u16 is_mc_list_enabled;u16 mc_list_count;bool is_autoneg;
@@ -54,6 +55,8 @@ struct aq_nic_cfg_s {#define AQ_NIC_FLAG_ERR_UNPLUG 0x40000000U#define AQ_NIC_FLAG_ERR_HW 0x80000000U +#define AQ_NIC_WOL_ENABLED BIT(0) +#define AQ_NIC_TCVEC2RING (_NIC_, _TC_, _VEC_) \ ((_TC_) * AQ_CFG_TCS_MAX + (_VEC_))
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +5 -5
@@ -438,7 +438,7 @@ int hw_atl_utils_fw_rpc_call(struct aq_hw_s *self, unsigned int rpc_size) }int hw_atl_utils_fw_rpc_wait (struct aq_hw_s *self, -struct hw_aq_atl_utils_fw_rpc **rpc) +struct hw_atl_utils_fw_rpc **rpc) {int err =0 ;struct aq_hw_atl_utils_fw_rpc_tid_s sw;
@@ -503,7 +503,7 @@ static int hw_atl_utils_mpi_create(struct aq_hw_s *self) }int hw_atl_utils_mpi_read_mbox (struct aq_hw_s *self, -struct hw_aq_atl_utils_mbox_header *pmbox) +struct hw_atl_utils_mbox_header *pmbox) { return hw_atl_utils_fw_downld_dwords(self, self->mbox_addr,
@@ -512,7 +512,7 @@ int hw_atl_utils_mpi_read_mbox(struct aq_hw_s *self, }void hw_atl_utils_mpi_read_stats (struct aq_hw_s *self, -struct hw_aq_atl_utils_mbox *pmbox) +struct hw_atl_utils_mbox *pmbox) {int err =0 ;
@@ -552,7 +552,7 @@ static int hw_atl_utils_mpi_set_state(struct aq_hw_s *self, {int err =0 ;u32 transaction_id =0 ; -struct hw_aq_atl_utils_mbox_header mbox; +struct hw_atl_utils_mbox_header mbox;u32 val =aq_hw_read_reg (self,HW_ATL_MPI_CONTROL_ADR );if (state ==MPI_RESET ) {
@@ -754,7 +754,7 @@ int hw_atl_utils_hw_set_power(struct aq_hw_s *self,int hw_atl_utils_update_stats (struct aq_hw_s *self) { -struct hw_aq_atl_utils_mbox mbox; +struct hw_atl_utils_mbox mbox;hw_atl_utils_mpi_read_stats (self, &mbox);
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h +96 -12
161 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +32 -0
@@ -16,6 +16,7 @@#include "../aq_pci_func.h" #include "../aq_ring.h" #include "../aq_vec.h" +#include "../aq_nic.h" #include "hw_atl_utils.h" #include "hw_atl_llh.h"
@@ -29,6 +30,37 @@#define HW_ATL_FW2X_MPI_STATE_ADDR 0x370#define HW_ATL_FW2X_MPI_STATE2_ADDR 0x374 +#define HW_ATL_FW2X_CAP_SLEEP_PROXY BIT(CAPS_HI_SLEEP_PROXY) +#define HW_ATL_FW2X_CAP_WOL BIT(CAPS_HI_WOL) + +#define HW_ATL_FW2X_CTRL_SLEEP_PROXY BIT(CTRL_SLEEP_PROXY) +#define HW_ATL_FW2X_CTRL_WOL BIT(CTRL_WOL) +#define HW_ATL_FW2X_CTRL_LINK_DROP BIT(CTRL_LINK_DROP) +#define HW_ATL_FW2X_CTRL_PAUSE BIT(CTRL_PAUSE) +#define HW_ATL_FW2X_CTRL_ASYMMETRIC_PAUSE BIT(CTRL_ASYMMETRIC_PAUSE) +#define HW_ATL_FW2X_CTRL_FORCE_RECONNECT BIT(CTRL_FORCE_RECONNECT) + +#define HAL_ATLANTIC_WOL_FILTERS_COUNT 8 +#define HAL_ATLANTIC_UTILS_FW2X_MSG_WOL 0x0E + +struct __packed fw2x_msg_wol_pattern { +u8 mask[16 ]; +u32 crc; +}; + +struct __packed fw2x_msg_wol { +u32 msg_id; +u8 hw_addr[6 ]; +u8 magic_packet_enabled; +u8 filter_count; +struct fw2x_msg_wol_pattern filter[HAL_ATLANTIC_WOL_FILTERS_COUNT ]; +u8 link_up_enabled; +u8 link_down_enabled; +u16 reserved; +u32 link_up_timeout; +u32 link_down_timeout; +}; +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);
Signature · 1 line
2.7.4
Re: [PATCH net-next 2/5] net: aquantia: definitions for WOL patch
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h union __packed ip_addr { · line 79
Quoted 3 lines
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h +1
-1-struct __packed hw_aq_atl_utils_fw_rpc { +struct __packed hw_atl_utils_fw_rpc {u32 msg_id;
Hi Igor
There is no explanation given as to why you decided to rename this structure. Please do the rename as a standalone patch, no functionality change. That makes it easier to review the new functionality.
Andrew
PATCH 3/5 net: aquantia: implement WOL support
In reply to Igor RusskikhFrom: Yana Esina <[email protected]>
Add WOL support. Currently only magic packet (ethtool -s <ethX> wol g) feature is implemented.
Remove hw_set_power and move that to FW_OPS set_power:
because WOL configuration behaves differently on 1x and 2x firmwares
--- .../net/ethernet/aquantia/atlantic/aq_ethtool.c | 32 +++++++ drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 5 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 12 +-- .../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 | 80 +++++++++++++++-- .../aquantia/atlantic/hw_atl/hw_atl_utils.h | 2 + .../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 99 +++++++++++++++++++++- 8 files changed, 215 insertions(+), 17 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +32 -0
@@ -285,6 +285,36 @@ static int aq_ethtool_set_coalesce(struct net_device *ndev,return aq_nic_update_interrupt_moderation_settings (aq_nic); } +static void aq_ethtool_get_wol (struct net_device *ndev, +struct ethtool_wolinfo *wol) +{ +struct aq_nic_s *aq_nic =netdev_priv (ndev); +struct aq_nic_cfg_s *cfg =aq_nic_get_cfg (aq_nic); + + wol->supported =WAKE_MAGIC ; + wol->wolopts =0 ; + +if (cfg->wol) + wol->wolopts |=WAKE_MAGIC ; +} + +static int aq_ethtool_set_wol (struct net_device *ndev, +struct ethtool_wolinfo *wol) +{ +struct aq_nic_s *aq_nic =netdev_priv (ndev); +struct aq_nic_cfg_s *cfg =aq_nic_get_cfg (aq_nic); +struct pci_dev *pdev =to_pci_dev (ndev->dev.parent); +int err =0 ; + +if (wol->wolopts &WAKE_MAGIC ) + cfg->wol |=AQ_NIC_WOL_ENABLED ; +else + cfg->wol &= ~AQ_NIC_WOL_ENABLED ; + err =device_set_wakeup_enable (&pdev->dev, wol->wolopts); + +return err; +} +static int aq_ethtool_nway_reset (struct net_device *ndev) {struct aq_nic_s *aq_nic =netdev_priv (ndev);
@@ -403,6 +433,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_wol = aq_ethtool_get_wol, + .set_wol = aq_ethtool_set_wol, .nway_reset = aq_ethtool_nway_reset, .get_ringparam = aq_get_ringparam, .set_ringparam = aq_set_ringparam,
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +4 -1
@@ -204,7 +204,6 @@ struct aq_hw_ops {int (*hw_get_fw_version)(struct aq_hw_s *self,u32 *fw_version); -int (*hw_set_power)(struct aq_hw_s *self,unsigned int power_state); };struct aq_fw_ops {
@@ -228,6 +227,10 @@ struct aq_fw_ops {int (*update_stats)(struct aq_hw_s *self);int (*set_flow_control)(struct aq_hw_s *self); + +int (*set_power)(struct aq_hw_s *self,unsigned int power_state, + u8 *mac); + };#endif /* AQ_HW_H */
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +7 -5
@@ -889,11 +889,13 @@ void aq_nic_deinit(struct aq_nic_s *self) self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i])aq_vec_deinit (aq_vec); -if (self->power_state ==AQ_HW_POWER_STATE_D0 ) { - (void )self->aq_fw_ops->deinit (self->aq_hw); - }else { - (void )self->aq_hw_ops->hw_set_power (self->aq_hw, - self->power_state); + (void )self->aq_fw_ops->deinit (self->aq_hw); + +if (self->power_state !=AQ_HW_POWER_STATE_D0 || + self->aq_hw->aq_nic_cfg->wol) { + (void )self->aq_fw_ops->set_power (self->aq_hw, + self->power_state, + self->ndev->dev_addr); } err_exit:;
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_set_power = hw_atl_utils_hw_set_power, .hw_reset = hw_atl_a0_hw_reset, .hw_start = hw_atl_a0_hw_start, .hw_ring_tx_start = hw_atl_a0_hw_ring_tx_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_set_power = hw_atl_utils_hw_set_power, .hw_reset = hw_atl_b0_hw_reset, .hw_start = hw_atl_b0_hw_start, .hw_ring_tx_start = hw_atl_b0_hw_ring_tx_start,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +72 -8
97 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h +2 -0
@@ -404,6 +404,8 @@ struct aq_stats_s *hw_atl_utils_get_hw_stats(struct aq_hw_s *self);int hw_atl_utils_fw_downld_dwords (struct aq_hw_s *self,u32 a,u32 *p,u32 cnt); +int hw_atl_utils_fw_set_wol (struct aq_hw_s *self,bool wol_enabled,u8 *mac); +int hw_atl_utils_fw_rpc_call (struct aq_hw_s *self,unsigned int rpc_size); int hw_atl_utils_fw_rpc_wait(struct aq_hw_s *self,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +98 -1
116 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH net-next 3/5] net: aquantia: implement WOL support
drivers/net/ethernet/aquantia/atlantic/aq_nic.c void aq_nic_deinit(struct aq_nic_s *self) · line 892
Quoted 12 lines
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +1
-5@@ -889,11 +889,13 @@ void aq_nic_deinit(struct aq_nic_s *self) self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i])aq_vec_deinit (aq_vec); -if (self->power_state ==AQ_HW_POWER_STATE_D0 ) { - (void )self->aq_fw_ops->deinit (self->aq_hw); - }else { - (void )self->aq_hw_ops->hw_set_power (self->aq_hw, - self->power_state); + (void )self->aq_fw_ops->deinit (self->aq_hw);
These void casts look a bit ugly. Are they needed? Is the compiler complaining? If it is complaining, it suggests you should not be casting anyway...
drivers/net/ethernet/aquantia/atlantic/aq_nic.c void aq_nic_deinit(struct aq_nic_s *self) · line 899
Quoted 7 lines
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +7
-0+if (wol_enabled) { + rpc_size =sizeof (prpc->msg_id) +sizeof (prpc->msg_wol); + + prpc->msg_id =HAL_ATLANTIC_UTILS_FW_MSG_WOL_ADD ; + prpc->msg_wol.priority =0x10000000 ;/* normal priority */ + prpc->msg_wol.pattern_id =1U ; + prpc->msg_wol.wol_packet_type =2U ;/* Magic Packet */
Maybe add #defines for these magic numbers?
Quoted 4 lines
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +4
-0+ +ether_addr_copy ((u8 *)&prpc->msg_wol.wol_pattern, mac); + }else { + rpc_size =sizeof (prpc->msg_id) +sizeof (prpc->msg_del_id);
drivers/net/ethernet/aquantia/atlantic/aq_nic.c void aq_nic_deinit(struct aq_nic_s *self)
Quoted 10 lines
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +10
-0+ + prpc->msg_id =HAL_ATLANTIC_UTILS_FW_MSG_WOL_DEL ; + prpc->msg_wol.pattern_id =1U ; + } + + err =hw_atl_utils_fw_rpc_call (self, rpc_size); + +err_exit: +return err; +}
Andrew
PATCH 4/5 net: aquantia: implement EEE support
In reply to Igor RusskikhFrom: Yana Esina <[email protected]>
Support of Energy-Efficient Ethernet to aQuantia NIC's via ethtool (according to the IEEE 802.3az specifications)
We do replace some duplicate speed bits definitions here (HW_ATL_B0_RATE_) with driver generic constants (AQ_NIC_RATE_)
--- drivers/net/ethernet/aquantia/atlantic/aq_common.h | 5 + .../net/ethernet/aquantia/atlantic/aq_ethtool.c | 76 +++++++++++ drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 4 + drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 1 + .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 32 ++--- .../aquantia/atlantic/hw_atl/hw_atl_a0_internal.h | 6 - .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 34 ++--- .../aquantia/atlantic/hw_atl/hw_atl_b0_internal.h | 6 - .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 2 + .../aquantia/atlantic/hw_atl/hw_atl_utils.h | 13 ++ .../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 141 +++++++++++++++++---- 11 files changed, 250 insertions(+), 70 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_common.h +5 -0
@@ -57,4 +57,9 @@#define AQ_NIC_RATE_1G BIT(4)#define AQ_NIC_RATE_100M BIT(5) +#define AQ_NIC_RATE_EEE_10G BIT(6) +#define AQ_NIC_RATE_EEE_5G BIT(7) +#define AQ_NIC_RATE_EEE_2GS BIT(8) +#define AQ_NIC_RATE_EEE_1G BIT(9) +#endif /* AQ_COMMON_H */
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +76 -0
88 lines not on this page · raw message
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +4 -0
@@ -231,6 +231,10 @@ struct aq_fw_ops {int (*set_power)(struct aq_hw_s *self,unsigned int power_state,u8 *mac); +int (*set_eee_rate)(struct aq_hw_s *self,u32 speed); + +int (*get_eee_rate)(struct aq_hw_s *self,u32 *rate, + u32 *supported_rates); };#endif /* AQ_HW_H */
drivers/net/ethernet/aquantia/atlantic/aq_nic.h +1 -0
@@ -45,6 +45,7 @@ struct aq_nic_cfg_s {bool is_lro;u8 tcs;struct aq_rss_parameters aq_rss; +u32 eee_speeds; };#define AQ_NIC_FLAG_STARTED 0x00000004U
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c +16 -16
@@ -49,37 +49,37 @@const struct aq_hw_caps_s hw_atl_a0_caps_aqc100 = {DEFAULT_A0_BOARD_BASIC_CAPABILITIES , .media_type =AQ_HW_MEDIA_TYPE_FIBRE , - .link_speed_msk =HW_ATL_A0_RATE_5G | -HW_ATL_A0_RATE_2G5 | -HW_ATL_A0_RATE_1G | -HW_ATL_A0_RATE_100M , + .link_speed_msk =AQ_NIC_RATE_5G | +AQ_NIC_RATE_2GS | +AQ_NIC_RATE_1G | +AQ_NIC_RATE_100M , };const struct aq_hw_caps_s hw_atl_a0_caps_aqc107 = {DEFAULT_A0_BOARD_BASIC_CAPABILITIES , .media_type =AQ_HW_MEDIA_TYPE_TP , - .link_speed_msk =HW_ATL_A0_RATE_10G | -HW_ATL_A0_RATE_5G | -HW_ATL_A0_RATE_2G5 | -HW_ATL_A0_RATE_1G | -HW_ATL_A0_RATE_100M , + .link_speed_msk =AQ_NIC_RATE_10G | +AQ_NIC_RATE_5G | +AQ_NIC_RATE_2GS | +AQ_NIC_RATE_1G | +AQ_NIC_RATE_100M , };const struct aq_hw_caps_s hw_atl_a0_caps_aqc108 = {DEFAULT_A0_BOARD_BASIC_CAPABILITIES , .media_type =AQ_HW_MEDIA_TYPE_TP , - .link_speed_msk =HW_ATL_A0_RATE_5G | -HW_ATL_A0_RATE_2G5 | -HW_ATL_A0_RATE_1G | -HW_ATL_A0_RATE_100M , + .link_speed_msk =AQ_NIC_RATE_5G | +AQ_NIC_RATE_2GS | +AQ_NIC_RATE_1G | +AQ_NIC_RATE_100M , };const struct aq_hw_caps_s hw_atl_a0_caps_aqc109 = {DEFAULT_A0_BOARD_BASIC_CAPABILITIES , .media_type =AQ_HW_MEDIA_TYPE_TP , - .link_speed_msk =HW_ATL_A0_RATE_2G5 | -HW_ATL_A0_RATE_1G | -HW_ATL_A0_RATE_100M , + .link_speed_msk =AQ_NIC_RATE_2GS | +AQ_NIC_RATE_1G | +AQ_NIC_RATE_100M , };static int hw_atl_a0_hw_reset (struct aq_hw_s *self)
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0_internal.h +0 -6
@@ -62,12 +62,6 @@#define HW_ATL_A0_MPI_SPEED_MSK 0xFFFFU#define HW_ATL_A0_MPI_SPEED_SHIFT 16U -#define HW_ATL_A0_RATE_10G BIT(0) -#define HW_ATL_A0_RATE_5G BIT(1) -#define HW_ATL_A0_RATE_2G5 BIT(3) -#define HW_ATL_A0_RATE_1G BIT(4) -#define HW_ATL_A0_RATE_100M BIT(5) -#define HW_ATL_A0_TXBUF_MAX 160U#define HW_ATL_A0_RXBUF_MAX 320U
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +17 -17
@@ -51,38 +51,38 @@const struct aq_hw_caps_s hw_atl_b0_caps_aqc100 = {DEFAULT_B0_BOARD_BASIC_CAPABILITIES , .media_type =AQ_HW_MEDIA_TYPE_FIBRE , - .link_speed_msk =HW_ATL_B0_RATE_10G | -HW_ATL_B0_RATE_5G | -HW_ATL_B0_RATE_2G5 | -HW_ATL_B0_RATE_1G | -HW_ATL_B0_RATE_100M , + .link_speed_msk =AQ_NIC_RATE_10G | +AQ_NIC_RATE_5G | +AQ_NIC_RATE_2GS | +AQ_NIC_RATE_1G | +AQ_NIC_RATE_100M , };const struct aq_hw_caps_s hw_atl_b0_caps_aqc107 = {DEFAULT_B0_BOARD_BASIC_CAPABILITIES , .media_type =AQ_HW_MEDIA_TYPE_TP , - .link_speed_msk =HW_ATL_B0_RATE_10G | -HW_ATL_B0_RATE_5G | -HW_ATL_B0_RATE_2G5 | -HW_ATL_B0_RATE_1G | -HW_ATL_B0_RATE_100M , + .link_speed_msk =AQ_NIC_RATE_10G | +AQ_NIC_RATE_5G | +AQ_NIC_RATE_2GS | +AQ_NIC_RATE_1G | +AQ_NIC_RATE_100M , };const struct aq_hw_caps_s hw_atl_b0_caps_aqc108 = {DEFAULT_B0_BOARD_BASIC_CAPABILITIES , .media_type =AQ_HW_MEDIA_TYPE_TP , - .link_speed_msk =HW_ATL_B0_RATE_5G | -HW_ATL_B0_RATE_2G5 | -HW_ATL_B0_RATE_1G | -HW_ATL_B0_RATE_100M , + .link_speed_msk =AQ_NIC_RATE_5G | +AQ_NIC_RATE_2GS | +AQ_NIC_RATE_1G | +AQ_NIC_RATE_100M , };const struct aq_hw_caps_s hw_atl_b0_caps_aqc109 = {DEFAULT_B0_BOARD_BASIC_CAPABILITIES , .media_type =AQ_HW_MEDIA_TYPE_TP , - .link_speed_msk =HW_ATL_B0_RATE_2G5 | -HW_ATL_B0_RATE_1G | -HW_ATL_B0_RATE_100M , + .link_speed_msk =AQ_NIC_RATE_2GS | +AQ_NIC_RATE_1G | +AQ_NIC_RATE_100M , };static int hw_atl_b0_hw_reset (struct aq_hw_s *self)
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0_internal.h +0 -6
@@ -67,12 +67,6 @@#define HW_ATL_B0_MPI_SPEED_MSK 0xFFFFU#define HW_ATL_B0_MPI_SPEED_SHIFT 16U -#define HW_ATL_B0_RATE_10G BIT(0) -#define HW_ATL_B0_RATE_5G BIT(1) -#define HW_ATL_B0_RATE_2G5 BIT(3) -#define HW_ATL_B0_RATE_1G BIT(4) -#define HW_ATL_B0_RATE_100M BIT(5) -#define HW_ATL_B0_TXBUF_MAX 160U#define HW_ATL_B0_RXBUF_MAX 320U
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +2 -0
@@ -912,5 +912,7 @@ const struct aq_fw_ops aq_fw_1x_ops = { .update_link_status = hw_atl_utils_mpi_get_link_status, .update_stats = hw_atl_utils_update_stats, .set_power = aq_fw1x_set_power, + .set_eee_rate = NULL, + .get_eee_rate = NULL, .set_flow_control = NULL, };
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h +13 -0
@@ -171,9 +171,22 @@ struct __packed hw_atl_utils_mbox_header {u32 error; }; +struct __packed hw_aq_info { +u8 reserved[6 ]; +u16 phy_fault_code; +u16 phy_temperature; +u8 cable_len; +u8 reserved1; +u32 cable_diag_data[4 ]; +u8 reserved2[32 ]; +u32 caps_lo; +u32 caps_hi; +}; +struct __packed hw_atl_utils_mbox {struct hw_atl_utils_mbox_header header;struct hw_atl_stats_s stats; +struct hw_aq_info info; };/* fw2x */
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +116 -25
208 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH net-next 4/5] net: aquantia: implement EEE support
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c static int aq_ethtool_set_wol(struct net_device *ndev, · line 339
Quoted 6 lines
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +6
-0+static int aq_ethtool_get_eee (struct net_device *ndev,struct ethtool_eee *eee) +{ +struct aq_nic_s *aq_nic =netdev_priv (ndev); +int err =0 ; + +u32 rate, supported_rates;
Please keep all local variables together and sort them as reverse christmas tree. This should apply to all new code you are adding.
Quoted 21 lines
index 3c94cff..a021dc4 100644
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0_internal.h +0
-6@@ -62,12 +62,6 @@#define HW_ATL_A0_MPI_SPEED_MSK 0xFFFFU#define HW_ATL_A0_MPI_SPEED_SHIFT 16U -#define HW_ATL_A0_RATE_10G BIT(0) -#define HW_ATL_A0_RATE_5G BIT(1) -#define HW_ATL_A0_RATE_2G5 BIT(3) -#define HW_ATL_A0_RATE_1G BIT(4) -#define HW_ATL_A0_RATE_100M BIT(5) -#define HW_ATL_A0_TXBUF_MAX 160U#define HW_ATL_A0_RXBUF_MAX 320Udrivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +0
-0
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c line 46
Quoted 7 lines
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +4
-0@@ -40,6 +40,11 @@#define HW_ATL_FW2X_CTRL_ASYMMETRIC_PAUSE BIT(CTRL_ASYMMETRIC_PAUSE)#define HW_ATL_FW2X_CTRL_FORCE_RECONNECT BIT(CTRL_FORCE_RECONNECT) +#define HW_ATL_FW2X_CAP_EEE_1G_MASK BIT(CAPS_HI_1000BASET_FD_EEE) +#define HW_ATL_FW2X_CAP_EEE_2G5_MASK BIT(CAPS_HI_2P5GBASET_FD_EEE) +#define HW_ATL_FW2X_CAP_EEE_5G_MASK BIT(CAPS_HI_5GBASET_FD_EEE) +#define HW_ATL_FW2X_CAP_EEE_10G_MASK BIT(CAPS_HI_10GBASET_FD_EEE)
Please do this rename as a separate patch, so we can clearly see new EEE code which needs close review, from the simple renaming which needs little review.
In general, it is better to have lots of simple patches, which do just one things, rather than a big patch making lots of unrelated changes.
Andrew
PATCH 5/5 net: aquantia: bump driver version
In reply to Igor Russkikh--- drivers/net/ethernet/aquantia/atlantic/ver.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/ver.h +1 -1
@@ -12,7 +12,7 @@#define NIC_MAJOR_DRIVER_VERSION 2#define NIC_MINOR_DRIVER_VERSION 0 -#define NIC_BUILD_DRIVER_VERSION 3 +#define NIC_BUILD_DRIVER_VERSION 4#define NIC_REVISION_DRIVER_VERSION 0#define AQ_CFG_DRV_VERSION_SUFFIX "-kern"
Signature · 1 line
2.7.4
Re: [PATCH net-next 5/5] net: aquantia: bump driver version
Quoted 10 lines · Igor Russkikh
Signed-off-by Igor Russkikh <[email protected]>--- drivers/net/ethernet/aquantia/atlantic/ver.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/aquantia/atlantic/ver.h +0
-0
drivers/net/ethernet/aquantia/atlantic/ver.h line 18
Quoted 8 lines
drivers/net/ethernet/aquantia/atlantic/ver.h +1
-1@@ -12,7 +12,7 @@#define NIC_MAJOR_DRIVER_VERSION 2#define NIC_MINOR_DRIVER_VERSION 0 -#define NIC_BUILD_DRIVER_VERSION 3 +#define NIC_BUILD_DRIVER_VERSION 4#define NIC_REVISION_DRIVER_VERSION 0#define AQ_CFG_DRV_VERSION_SUFFIX "-kern"
Hi Igor
Driver versions are pretty much useless. Say somebody backports this driver into a vendor kernel. Vendor kernels are typically based on an old kernel, plus thousands of patches. Is 2.0.4 on such a kernel the same as 2.0.4 in 4.19?
You probably want to remove this, just the avoid people thinking is means something.
Andrew
Re: [PATCH net-next 5/5] net: aquantia: bump driver version
Hi Andrew,
Thanks for the review, agreed on all your findings, we'll address these comments in next version.
Quoted 7 lines
Driver versions are pretty much useless. Say somebody backports this driver into a vendor kernel. Vendor kernels are typically based on an old kernel, plus thousands of patches. Is 2.0.4 on such a kernel the same as 2.0.4 in 4.19?
You probably want to remove this, just the avoid people thinking is means something.
We do distribute our driver as a separate source package, customers for older kernels use it and install without updating their kernels.
We also in fact always have a gap in featureset between upstream driver and our preview driver releases on github - alot of people tend to tryout 'hot and latest' driver instead of waiting for their distro kernel to receive updates.
All this means we have to understand which version (and featureset) users have installed in fields.
ethtool -i and this internal driver version is a huge helper for us.
You are right that in event of backporting there could be some uncertainty whether that bugfix is there or not. But having kernel version plus driver version really helps us to understand the exact configuration in fields.
Moreover, inkernel driver version bumps are linked with new features added (like in this patchset). Thus the overall concept of internal version is still very useful for Aquantia technical and support engineers.
Hope the above are good enough arguments to keep up version bumps.
BR, Igor
Re: [PATCH net-next 5/5] net: aquantia: bump driver version
Quoted 30 lines · Igor Russkikh
Hi Andrew,
Thanks for the review, agreed on all your findings, we'll address these comments in next version.
Quoted 7 lines
Driver versions are pretty much useless. Say somebody backports this driver into a vendor kernel. Vendor kernels are typically based on an old kernel, plus thousands of patches. Is 2.0.4 on such a kernel the same as 2.0.4 in 4.19?
You probably want to remove this, just the avoid people thinking is means something.
We do distribute our driver as a separate source package, customers for older kernels use it and install without updating their kernels.
We also in fact always have a gap in featureset between upstream driver and our preview driver releases on github - alot of people tend to tryout 'hot and latest' driver instead of waiting for their distro kernel to receive updates.
All this means we have to understand which version (and featureset) users have installed in fields.
ethtool -iand this internal driver version is a huge helper for us.You are right that in event of backporting there could be some uncertainty whether that bugfix is there or not. But having kernel version plus driver version really helps us to understand the exact configuration in fields.
Quoted 6 lines
Moreover, inkernel driver version bumps are linked with new features added (like in this patchset). Thus the overall concept of internal version is still very useful for Aquantia technical and support engineers.
Hope the above are good enough arguments to keep up version bumps.
A reasonably successful strategy is to version your out-of-tree driver with corresponding kernel release versions. Flip the equation.
E.g. current net-next will become 4.19, so all the features you're pushing now would in your GH repo be:
4.19.0.${extra_numbers_if_you_want}-gh
And you still have single versioning scheme, but the "bump to version XYZ" commits now go into your local tree not the kernel.
As Andrew said backports make driver versions less than useful. Not only feature backports to enterprise kernel, but bug fixes which have to go to stable.
Re: [PATCH net-next 5/5] net: aquantia: bump driver version
Quoted 10 lines
Quoted 3 lines
Hope the above are good enough arguments to keep up version bumps.
A reasonably successful strategy is to version your out-of-tree driver with corresponding kernel release versions. Flip the equation.
E.g. current net-next will become 4.19, so all the features you're pushing now would in your GH repo be:
Quoted 9 lines
4.19.0.${extra_numbers_if_you_want}-gh
And you still have single versioning scheme, but the "bump to version XYZ" commits now go into your local tree not the kernel.
As Andrew said backports make driver versions less than useful. Not only feature backports to enterprise kernel, but bug fixes which have to go to stable.
Technically yes, thats a good and manageable suggestion.
However the problem here is a human factor.
Regular users are often aware that NIC drivers are regularly get updates, fixes etc. And they logically assume there is a driver version in there. And what user normally does first time he/she buys new NIC is checking driver version in system.
Obviously what user use is ethtool -i since thats a documented and the only user visible tool.
What we'll get here is totally uncorrelated versioning info between inkernel driver (some ancient version or no version at all) and vendor driver.
This will confuse user as he/she will start thinking (for example) that his in kernel driver is "bad" and has to be updated.
Another human factor is tech support personnel, who also expect NIC drivers to have version. We'll get tons of requests sort of "why and when you'll update your upstream driver". It is up to date. "But why its version is not updated then?"
A lot of technical reports from fields does not include kernel version, but (since users talk about NIC) just an "ethtool -i" output. This'll confuse us as we have to do more queries on kernel version.
These are all legitimate expectations from non-tech people and what we trying to do now is to keep up inkernel versioning with our local versioning.
Thus, user now sees:
version: 2.0.3.0-kern (for inkernel driver)
or
version: 2.0.6.0 (for external driver)
and can at least judge whether he needs updates or if thats OK.
As a one liner sumup:
kernel have user visible 'ethtool -i' API. Why should we drop it and deprecate it?
BR, Igor