{
struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg;
- cfg->aq_hw_caps = &self->aq_hw_caps;
-
cfg->vecs = AQ_CFG_VECS_DEF;
cfg->tcs = AQ_CFG_TCS_DEF;
cfg->irq_type = aq_pci_func_get_irq_type(self->aq_pci_func);
if ((cfg->irq_type == AQ_HW_IRQ_LEGACY) ||
- (self->aq_hw_caps.vecs == 1U) ||
+ (cfg->aq_hw_caps->vecs == 1U) ||
(cfg->vecs == 1U)) {
cfg->is_rss = 0U;
cfg->vecs = 1U;
}
- cfg->link_speed_msk &= self->aq_hw_caps.link_speed_msk;
- cfg->hw_features = self->aq_hw_caps.hw_features;
+ cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk;
+ cfg->hw_features = cfg->aq_hw_caps->hw_features;
return 0;
}
static int aq_nic_update_link_status(struct aq_nic_s *self)
{
- int err = self->aq_hw_ops.hw_get_link_status(self->aq_hw);
+ int err = self->aq_hw_ops->hw_get_link_status(self->aq_hw);
if (err)
return err;
if (err)
goto err_exit;
- if (self->aq_hw_ops.hw_update_stats)
- self->aq_hw_ops.hw_update_stats(self->aq_hw);
+ if (self->aq_hw_ops->hw_update_stats)
+ self->aq_hw_ops->hw_update_stats(self->aq_hw);
aq_nic_update_ndev_stats(self);
self->aq_pci_func = aq_pci_func;
- self->aq_hw_ops = *aq_hw_ops;
- self->aq_hw_caps = *aq_hw_caps;
+ self->aq_hw_ops = aq_hw_ops;
+ self->aq_nic_cfg.aq_hw_caps = aq_hw_caps;
+ self->aq_hw->aq_nic_cfg = &self->aq_nic_cfg;
self->port = (u8)port;
- self->aq_hw = self->aq_hw_ops.create(aq_pci_func, self->port);
- self->aq_hw->aq_nic_cfg = &self->aq_nic_cfg;
+ self->aq_hw = self->aq_hw_ops->create(aq_pci_func, self->port);
+ if (err < 0)
+ goto err_exit;
aq_nic_cfg_init_defaults(self);
err = -EINVAL;
goto err_exit;
}
- err = self->aq_hw_ops.hw_get_mac_permanent(self->aq_hw,
+ err = self->aq_hw_ops->hw_get_mac_permanent(self->aq_hw,
self->ndev->dev_addr);
if (err < 0)
goto err_exit;
self->ndev->features = aq_hw_caps->hw_features;
self->ndev->priv_flags = aq_hw_caps->hw_priv_flags;
self->ndev->mtu = aq_nic_cfg->mtu - ETH_HLEN;
- self->ndev->max_mtu = self->aq_hw_caps.mtu - ETH_FCS_LEN - ETH_HLEN;
+ self->ndev->max_mtu = aq_hw_caps->mtu - ETH_FCS_LEN - ETH_HLEN;
return 0;
}
unregister_netdev(self->ndev);
if (self->aq_hw)
- self->aq_hw_ops.destroy(self->aq_hw);
+ self->aq_hw_ops->destroy(self->aq_hw);
free_netdev(self->ndev);
unsigned int i = 0U;
self->power_state = AQ_HW_POWER_STATE_D0;
- err = self->aq_hw_ops.hw_reset(self->aq_hw);
+ err = self->aq_hw_ops->hw_reset(self->aq_hw);
if (err < 0)
goto err_exit;
- err = self->aq_hw_ops.hw_init(self->aq_hw,
+ err = self->aq_hw_ops->hw_init(self->aq_hw,
aq_nic_get_ndev(self)->dev_addr);
if (err < 0)
goto err_exit;
for (i = 0U, aq_vec = self->aq_vec[0];
self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i])
- aq_vec_init(aq_vec, &self->aq_hw_ops, self->aq_hw);
+ aq_vec_init(aq_vec, self->aq_hw_ops, self->aq_hw);
err_exit:
return err;
int err = 0;
unsigned int i = 0U;
- err = self->aq_hw_ops.hw_multicast_list_set(self->aq_hw,
+ err = self->aq_hw_ops->hw_multicast_list_set(self->aq_hw,
self->mc_list.ar,
self->mc_list.count);
if (err < 0)
goto err_exit;
- err = self->aq_hw_ops.hw_packet_filter_set(self->aq_hw,
+ err = self->aq_hw_ops->hw_packet_filter_set(self->aq_hw,
self->packet_filter);
if (err < 0)
goto err_exit;
goto err_exit;
}
- err = self->aq_hw_ops.hw_start(self->aq_hw);
+ err = self->aq_hw_ops->hw_start(self->aq_hw);
if (err < 0)
goto err_exit;
goto err_exit;
}
- err = self->aq_hw_ops.hw_irq_enable(self->aq_hw,
+ err = self->aq_hw_ops->hw_irq_enable(self->aq_hw,
AQ_CFG_IRQ_MASK);
if (err < 0)
goto err_exit;
frags = aq_nic_map_skb(self, skb, ring);
if (likely(frags)) {
- err = self->aq_hw_ops.hw_ring_tx_xmit(self->aq_hw,
+ err = self->aq_hw_ops->hw_ring_tx_xmit(self->aq_hw,
ring,
frags);
if (err >= 0) {
int aq_nic_update_interrupt_moderation_settings(struct aq_nic_s *self)
{
- return self->aq_hw_ops.hw_interrupt_moderation_set(self->aq_hw);
+ return self->aq_hw_ops->hw_interrupt_moderation_set(self->aq_hw);
}
int aq_nic_set_packet_filter(struct aq_nic_s *self, unsigned int flags)
{
int err = 0;
- err = self->aq_hw_ops.hw_packet_filter_set(self->aq_hw, flags);
+ err = self->aq_hw_ops->hw_packet_filter_set(self->aq_hw, flags);
if (err < 0)
goto err_exit;
* 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->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,
+ return self->aq_hw_ops->hw_multicast_list_set(self->aq_hw,
self->mc_list.ar,
self->mc_list.count);
}
int aq_nic_set_mac(struct aq_nic_s *self, struct net_device *ndev)
{
- return self->aq_hw_ops.hw_set_mac_address(self->aq_hw, ndev->dev_addr);
+ return self->aq_hw_ops->hw_set_mac_address(self->aq_hw, ndev->dev_addr);
}
unsigned int aq_nic_get_link_speed(struct aq_nic_s *self)
regs->version = 1;
- err = self->aq_hw_ops.hw_get_regs(self->aq_hw,
- &self->aq_hw_caps, regs_buff);
+ err = self->aq_hw_ops->hw_get_regs(self->aq_hw,
+ self->aq_nic_cfg.aq_hw_caps,
+ regs_buff);
if (err < 0)
goto err_exit;
int aq_nic_get_regs_count(struct aq_nic_s *self)
{
- return self->aq_hw_caps.mac_regs_count;
+ return self->aq_nic_cfg.aq_hw_caps->mac_regs_count;
}
void aq_nic_get_stats(struct aq_nic_s *self, u64 *data)
unsigned int i = 0U;
unsigned int count = 0U;
struct aq_vec_s *aq_vec = NULL;
- struct aq_stats_s *stats = self->aq_hw_ops.hw_get_hw_stats(self->aq_hw);
+ struct aq_stats_s *stats = self->aq_hw_ops->hw_get_hw_stats(self->aq_hw);
if (!stats)
goto err_exit;
static void aq_nic_update_ndev_stats(struct aq_nic_s *self)
{
struct net_device *ndev = self->ndev;
- struct aq_stats_s *stats = self->aq_hw_ops.hw_get_hw_stats(self->aq_hw);
+ struct aq_stats_s *stats = self->aq_hw_ops->hw_get_hw_stats(self->aq_hw);
ndev->stats.rx_packets = stats->uprc + stats->mprc + stats->bprc;
ndev->stats.rx_bytes = stats->ubrc + stats->mbrc + stats->bbrc;
ethtool_link_ksettings_zero_link_mode(cmd, supported);
- if (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_10G)
+ if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_10G)
ethtool_link_ksettings_add_link_mode(cmd, supported,
10000baseT_Full);
- if (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_5G)
+ if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_5G)
ethtool_link_ksettings_add_link_mode(cmd, supported,
5000baseT_Full);
- if (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_2GS)
+ if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_2GS)
ethtool_link_ksettings_add_link_mode(cmd, supported,
2500baseT_Full);
- if (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_1G)
+ if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_1G)
ethtool_link_ksettings_add_link_mode(cmd, supported,
1000baseT_Full);
- if (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_100M)
+ if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_100M)
ethtool_link_ksettings_add_link_mode(cmd, supported,
100baseT_Full);
- if (self->aq_hw_caps.flow_control)
+ if (self->aq_nic_cfg.aq_hw_caps->flow_control)
ethtool_link_ksettings_add_link_mode(cmd, supported,
Pause);
int err = 0;
if (cmd->base.autoneg == AUTONEG_ENABLE) {
- rate = self->aq_hw_caps.link_speed_msk;
+ rate = self->aq_nic_cfg.aq_hw_caps->link_speed_msk;
self->aq_nic_cfg.is_autoneg = true;
} else {
speed = cmd->base.speed;
goto err_exit;
break;
}
- if (!(self->aq_hw_caps.link_speed_msk & rate)) {
+ if (!(self->aq_nic_cfg.aq_hw_caps->link_speed_msk & rate)) {
err = -1;
goto err_exit;
}
self->aq_nic_cfg.is_autoneg = false;
}
- err = self->aq_hw_ops.hw_set_link_speed(self->aq_hw, rate);
+ err = self->aq_hw_ops->hw_set_link_speed(self->aq_hw, rate);
if (err < 0)
goto err_exit;
{
u32 fw_version = 0U;
- self->aq_hw_ops.hw_get_fw_version(self->aq_hw, &fw_version);
+ self->aq_hw_ops->hw_get_fw_version(self->aq_hw, &fw_version);
return fw_version;
}
del_timer_sync(&self->service_timer);
- self->aq_hw_ops.hw_irq_disable(self->aq_hw, AQ_CFG_IRQ_MASK);
+ self->aq_hw_ops->hw_irq_disable(self->aq_hw, AQ_CFG_IRQ_MASK);
if (self->aq_nic_cfg.is_polling)
del_timer_sync(&self->polling_timer);
self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i])
aq_vec_stop(aq_vec);
- return self->aq_hw_ops.hw_stop(self->aq_hw);
+ return self->aq_hw_ops->hw_stop(self->aq_hw);
}
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_hw_ops->hw_deinit(self->aq_hw);
} else {
- (void)self->aq_hw_ops.hw_set_power(self->aq_hw,
+ (void)self->aq_hw_ops->hw_set_power(self->aq_hw,
self->power_state);
}