@@ -66,8 +66,6 @@ static void aq_nic_cfg_init_defaults(struct aq_nic_s *self)
66
66
{
67
67
struct aq_nic_cfg_s * cfg = & self -> aq_nic_cfg ;
68
68
69
- cfg -> aq_hw_caps = & self -> aq_hw_caps ;
70
-
71
69
cfg -> vecs = AQ_CFG_VECS_DEF ;
72
70
cfg -> tcs = AQ_CFG_TCS_DEF ;
73
71
@@ -123,20 +121,20 @@ int aq_nic_cfg_start(struct aq_nic_s *self)
123
121
cfg -> irq_type = aq_pci_func_get_irq_type (self -> aq_pci_func );
124
122
125
123
if ((cfg -> irq_type == AQ_HW_IRQ_LEGACY ) ||
126
- (self -> aq_hw_caps . vecs == 1U ) ||
124
+ (cfg -> aq_hw_caps -> vecs == 1U ) ||
127
125
(cfg -> vecs == 1U )) {
128
126
cfg -> is_rss = 0U ;
129
127
cfg -> vecs = 1U ;
130
128
}
131
129
132
- cfg -> link_speed_msk &= self -> aq_hw_caps . link_speed_msk ;
133
- cfg -> hw_features = self -> aq_hw_caps . hw_features ;
130
+ cfg -> link_speed_msk &= cfg -> aq_hw_caps -> link_speed_msk ;
131
+ cfg -> hw_features = cfg -> aq_hw_caps -> hw_features ;
134
132
return 0 ;
135
133
}
136
134
137
135
static int aq_nic_update_link_status (struct aq_nic_s * self )
138
136
{
139
- int err = self -> aq_hw_ops . hw_get_link_status (self -> aq_hw );
137
+ int err = self -> aq_hw_ops -> hw_get_link_status (self -> aq_hw );
140
138
141
139
if (err )
142
140
return err ;
@@ -178,8 +176,8 @@ static void aq_nic_service_timer_cb(struct timer_list *t)
178
176
if (err )
179
177
goto err_exit ;
180
178
181
- if (self -> aq_hw_ops . hw_update_stats )
182
- self -> aq_hw_ops . hw_update_stats (self -> aq_hw );
179
+ if (self -> aq_hw_ops -> hw_update_stats )
180
+ self -> aq_hw_ops -> hw_update_stats (self -> aq_hw );
183
181
184
182
aq_nic_update_ndev_stats (self );
185
183
@@ -230,12 +228,14 @@ struct aq_nic_s *aq_nic_alloc_cold(struct pci_dev *pdev,
230
228
231
229
self -> aq_pci_func = aq_pci_func ;
232
230
233
- self -> aq_hw_ops = * aq_hw_ops ;
234
- self -> aq_hw_caps = * aq_hw_caps ;
231
+ self -> aq_hw_ops = aq_hw_ops ;
232
+ self -> aq_nic_cfg .aq_hw_caps = aq_hw_caps ;
233
+ self -> aq_hw -> aq_nic_cfg = & self -> aq_nic_cfg ;
235
234
self -> port = (u8 )port ;
236
235
237
- self -> aq_hw = self -> aq_hw_ops .create (aq_pci_func , self -> port );
238
- self -> aq_hw -> aq_nic_cfg = & self -> aq_nic_cfg ;
236
+ self -> aq_hw = self -> aq_hw_ops -> create (aq_pci_func , self -> port );
237
+ if (err < 0 )
238
+ goto err_exit ;
239
239
240
240
aq_nic_cfg_init_defaults (self );
241
241
@@ -255,7 +255,7 @@ int aq_nic_ndev_register(struct aq_nic_s *self)
255
255
err = - EINVAL ;
256
256
goto err_exit ;
257
257
}
258
- err = self -> aq_hw_ops . hw_get_mac_permanent (self -> aq_hw ,
258
+ err = self -> aq_hw_ops -> hw_get_mac_permanent (self -> aq_hw ,
259
259
self -> ndev -> dev_addr );
260
260
if (err < 0 )
261
261
goto err_exit ;
@@ -289,7 +289,7 @@ int aq_nic_ndev_init(struct aq_nic_s *self)
289
289
self -> ndev -> features = aq_hw_caps -> hw_features ;
290
290
self -> ndev -> priv_flags = aq_hw_caps -> hw_priv_flags ;
291
291
self -> ndev -> mtu = aq_nic_cfg -> mtu - ETH_HLEN ;
292
- self -> ndev -> max_mtu = self -> aq_hw_caps . mtu - ETH_FCS_LEN - ETH_HLEN ;
292
+ self -> ndev -> max_mtu = aq_hw_caps -> mtu - ETH_FCS_LEN - ETH_HLEN ;
293
293
294
294
return 0 ;
295
295
}
@@ -303,7 +303,7 @@ void aq_nic_ndev_free(struct aq_nic_s *self)
303
303
unregister_netdev (self -> ndev );
304
304
305
305
if (self -> aq_hw )
306
- self -> aq_hw_ops . destroy (self -> aq_hw );
306
+ self -> aq_hw_ops -> destroy (self -> aq_hw );
307
307
308
308
free_netdev (self -> ndev );
309
309
@@ -365,18 +365,18 @@ int aq_nic_init(struct aq_nic_s *self)
365
365
unsigned int i = 0U ;
366
366
367
367
self -> power_state = AQ_HW_POWER_STATE_D0 ;
368
- err = self -> aq_hw_ops . hw_reset (self -> aq_hw );
368
+ err = self -> aq_hw_ops -> hw_reset (self -> aq_hw );
369
369
if (err < 0 )
370
370
goto err_exit ;
371
371
372
- err = self -> aq_hw_ops . hw_init (self -> aq_hw ,
372
+ err = self -> aq_hw_ops -> hw_init (self -> aq_hw ,
373
373
aq_nic_get_ndev (self )-> dev_addr );
374
374
if (err < 0 )
375
375
goto err_exit ;
376
376
377
377
for (i = 0U , aq_vec = self -> aq_vec [0 ];
378
378
self -> aq_vecs > i ; ++ i , aq_vec = self -> aq_vec [i ])
379
- aq_vec_init (aq_vec , & self -> aq_hw_ops , self -> aq_hw );
379
+ aq_vec_init (aq_vec , self -> aq_hw_ops , self -> aq_hw );
380
380
381
381
err_exit :
382
382
return err ;
@@ -388,13 +388,13 @@ int aq_nic_start(struct aq_nic_s *self)
388
388
int err = 0 ;
389
389
unsigned int i = 0U ;
390
390
391
- err = self -> aq_hw_ops . hw_multicast_list_set (self -> aq_hw ,
391
+ err = self -> aq_hw_ops -> hw_multicast_list_set (self -> aq_hw ,
392
392
self -> mc_list .ar ,
393
393
self -> mc_list .count );
394
394
if (err < 0 )
395
395
goto err_exit ;
396
396
397
- err = self -> aq_hw_ops . hw_packet_filter_set (self -> aq_hw ,
397
+ err = self -> aq_hw_ops -> hw_packet_filter_set (self -> aq_hw ,
398
398
self -> packet_filter );
399
399
if (err < 0 )
400
400
goto err_exit ;
@@ -406,7 +406,7 @@ int aq_nic_start(struct aq_nic_s *self)
406
406
goto err_exit ;
407
407
}
408
408
409
- err = self -> aq_hw_ops . hw_start (self -> aq_hw );
409
+ err = self -> aq_hw_ops -> hw_start (self -> aq_hw );
410
410
if (err < 0 )
411
411
goto err_exit ;
412
412
@@ -431,7 +431,7 @@ int aq_nic_start(struct aq_nic_s *self)
431
431
goto err_exit ;
432
432
}
433
433
434
- err = self -> aq_hw_ops . hw_irq_enable (self -> aq_hw ,
434
+ err = self -> aq_hw_ops -> hw_irq_enable (self -> aq_hw ,
435
435
AQ_CFG_IRQ_MASK );
436
436
if (err < 0 )
437
437
goto err_exit ;
@@ -616,7 +616,7 @@ int aq_nic_xmit(struct aq_nic_s *self, struct sk_buff *skb)
616
616
frags = aq_nic_map_skb (self , skb , ring );
617
617
618
618
if (likely (frags )) {
619
- err = self -> aq_hw_ops . hw_ring_tx_xmit (self -> aq_hw ,
619
+ err = self -> aq_hw_ops -> hw_ring_tx_xmit (self -> aq_hw ,
620
620
ring ,
621
621
frags );
622
622
if (err >= 0 ) {
@@ -633,14 +633,14 @@ int aq_nic_xmit(struct aq_nic_s *self, struct sk_buff *skb)
633
633
634
634
int aq_nic_update_interrupt_moderation_settings (struct aq_nic_s * self )
635
635
{
636
- return self -> aq_hw_ops . hw_interrupt_moderation_set (self -> aq_hw );
636
+ return self -> aq_hw_ops -> hw_interrupt_moderation_set (self -> aq_hw );
637
637
}
638
638
639
639
int aq_nic_set_packet_filter (struct aq_nic_s * self , unsigned int flags )
640
640
{
641
641
int err = 0 ;
642
642
643
- err = self -> aq_hw_ops . hw_packet_filter_set (self -> aq_hw , flags );
643
+ err = self -> aq_hw_ops -> hw_packet_filter_set (self -> aq_hw , flags );
644
644
if (err < 0 )
645
645
goto err_exit ;
646
646
@@ -672,11 +672,11 @@ int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev)
672
672
* multicast mask
673
673
*/
674
674
self -> packet_filter |= IFF_ALLMULTI ;
675
- self -> aq_hw -> aq_nic_cfg -> mc_list_count = 0 ;
676
- return self -> aq_hw_ops . hw_packet_filter_set (self -> aq_hw ,
675
+ self -> aq_nic_cfg . mc_list_count = 0 ;
676
+ return self -> aq_hw_ops -> hw_packet_filter_set (self -> aq_hw ,
677
677
self -> packet_filter );
678
678
} else {
679
- return self -> aq_hw_ops . hw_multicast_list_set (self -> aq_hw ,
679
+ return self -> aq_hw_ops -> hw_multicast_list_set (self -> aq_hw ,
680
680
self -> mc_list .ar ,
681
681
self -> mc_list .count );
682
682
}
@@ -691,7 +691,7 @@ int aq_nic_set_mtu(struct aq_nic_s *self, int new_mtu)
691
691
692
692
int aq_nic_set_mac (struct aq_nic_s * self , struct net_device * ndev )
693
693
{
694
- return self -> aq_hw_ops . hw_set_mac_address (self -> aq_hw , ndev -> dev_addr );
694
+ return self -> aq_hw_ops -> hw_set_mac_address (self -> aq_hw , ndev -> dev_addr );
695
695
}
696
696
697
697
unsigned int aq_nic_get_link_speed (struct aq_nic_s * self )
@@ -706,8 +706,9 @@ int aq_nic_get_regs(struct aq_nic_s *self, struct ethtool_regs *regs, void *p)
706
706
707
707
regs -> version = 1 ;
708
708
709
- err = self -> aq_hw_ops .hw_get_regs (self -> aq_hw ,
710
- & self -> aq_hw_caps , regs_buff );
709
+ err = self -> aq_hw_ops -> hw_get_regs (self -> aq_hw ,
710
+ self -> aq_nic_cfg .aq_hw_caps ,
711
+ regs_buff );
711
712
if (err < 0 )
712
713
goto err_exit ;
713
714
@@ -717,15 +718,15 @@ int aq_nic_get_regs(struct aq_nic_s *self, struct ethtool_regs *regs, void *p)
717
718
718
719
int aq_nic_get_regs_count (struct aq_nic_s * self )
719
720
{
720
- return self -> aq_hw_caps . mac_regs_count ;
721
+ return self -> aq_nic_cfg . aq_hw_caps -> mac_regs_count ;
721
722
}
722
723
723
724
void aq_nic_get_stats (struct aq_nic_s * self , u64 * data )
724
725
{
725
726
unsigned int i = 0U ;
726
727
unsigned int count = 0U ;
727
728
struct aq_vec_s * aq_vec = NULL ;
728
- struct aq_stats_s * stats = self -> aq_hw_ops . hw_get_hw_stats (self -> aq_hw );
729
+ struct aq_stats_s * stats = self -> aq_hw_ops -> hw_get_hw_stats (self -> aq_hw );
729
730
730
731
if (!stats )
731
732
goto err_exit ;
@@ -770,7 +771,7 @@ err_exit:;
770
771
static void aq_nic_update_ndev_stats (struct aq_nic_s * self )
771
772
{
772
773
struct net_device * ndev = self -> ndev ;
773
- struct aq_stats_s * stats = self -> aq_hw_ops . hw_get_hw_stats (self -> aq_hw );
774
+ struct aq_stats_s * stats = self -> aq_hw_ops -> hw_get_hw_stats (self -> aq_hw );
774
775
775
776
ndev -> stats .rx_packets = stats -> uprc + stats -> mprc + stats -> bprc ;
776
777
ndev -> stats .rx_bytes = stats -> ubrc + stats -> mbrc + stats -> bbrc ;
@@ -791,27 +792,27 @@ void aq_nic_get_link_ksettings(struct aq_nic_s *self,
791
792
792
793
ethtool_link_ksettings_zero_link_mode (cmd , supported );
793
794
794
- if (self -> aq_hw_caps . link_speed_msk & AQ_NIC_RATE_10G )
795
+ if (self -> aq_nic_cfg . aq_hw_caps -> link_speed_msk & AQ_NIC_RATE_10G )
795
796
ethtool_link_ksettings_add_link_mode (cmd , supported ,
796
797
10000b aseT_Full );
797
798
798
- if (self -> aq_hw_caps . link_speed_msk & AQ_NIC_RATE_5G )
799
+ if (self -> aq_nic_cfg . aq_hw_caps -> link_speed_msk & AQ_NIC_RATE_5G )
799
800
ethtool_link_ksettings_add_link_mode (cmd , supported ,
800
801
5000b aseT_Full );
801
802
802
- if (self -> aq_hw_caps . link_speed_msk & AQ_NIC_RATE_2GS )
803
+ if (self -> aq_nic_cfg . aq_hw_caps -> link_speed_msk & AQ_NIC_RATE_2GS )
803
804
ethtool_link_ksettings_add_link_mode (cmd , supported ,
804
805
2500b aseT_Full );
805
806
806
- if (self -> aq_hw_caps . link_speed_msk & AQ_NIC_RATE_1G )
807
+ if (self -> aq_nic_cfg . aq_hw_caps -> link_speed_msk & AQ_NIC_RATE_1G )
807
808
ethtool_link_ksettings_add_link_mode (cmd , supported ,
808
809
1000b aseT_Full );
809
810
810
- if (self -> aq_hw_caps . link_speed_msk & AQ_NIC_RATE_100M )
811
+ if (self -> aq_nic_cfg . aq_hw_caps -> link_speed_msk & AQ_NIC_RATE_100M )
811
812
ethtool_link_ksettings_add_link_mode (cmd , supported ,
812
813
100b aseT_Full );
813
814
814
- if (self -> aq_hw_caps . flow_control )
815
+ if (self -> aq_nic_cfg . aq_hw_caps -> flow_control )
815
816
ethtool_link_ksettings_add_link_mode (cmd , supported ,
816
817
Pause );
817
818
@@ -858,7 +859,7 @@ int aq_nic_set_link_ksettings(struct aq_nic_s *self,
858
859
int err = 0 ;
859
860
860
861
if (cmd -> base .autoneg == AUTONEG_ENABLE ) {
861
- rate = self -> aq_hw_caps . link_speed_msk ;
862
+ rate = self -> aq_nic_cfg . aq_hw_caps -> link_speed_msk ;
862
863
self -> aq_nic_cfg .is_autoneg = true;
863
864
} else {
864
865
speed = cmd -> base .speed ;
@@ -889,15 +890,15 @@ int aq_nic_set_link_ksettings(struct aq_nic_s *self,
889
890
goto err_exit ;
890
891
break ;
891
892
}
892
- if (!(self -> aq_hw_caps . link_speed_msk & rate )) {
893
+ if (!(self -> aq_nic_cfg . aq_hw_caps -> link_speed_msk & rate )) {
893
894
err = -1 ;
894
895
goto err_exit ;
895
896
}
896
897
897
898
self -> aq_nic_cfg .is_autoneg = false;
898
899
}
899
900
900
- err = self -> aq_hw_ops . hw_set_link_speed (self -> aq_hw , rate );
901
+ err = self -> aq_hw_ops -> hw_set_link_speed (self -> aq_hw , rate );
901
902
if (err < 0 )
902
903
goto err_exit ;
903
904
@@ -916,7 +917,7 @@ u32 aq_nic_get_fw_version(struct aq_nic_s *self)
916
917
{
917
918
u32 fw_version = 0U ;
918
919
919
- self -> aq_hw_ops . hw_get_fw_version (self -> aq_hw , & fw_version );
920
+ self -> aq_hw_ops -> hw_get_fw_version (self -> aq_hw , & fw_version );
920
921
921
922
return fw_version ;
922
923
}
@@ -931,7 +932,7 @@ int aq_nic_stop(struct aq_nic_s *self)
931
932
932
933
del_timer_sync (& self -> service_timer );
933
934
934
- self -> aq_hw_ops . hw_irq_disable (self -> aq_hw , AQ_CFG_IRQ_MASK );
935
+ self -> aq_hw_ops -> hw_irq_disable (self -> aq_hw , AQ_CFG_IRQ_MASK );
935
936
936
937
if (self -> aq_nic_cfg .is_polling )
937
938
del_timer_sync (& self -> polling_timer );
@@ -942,7 +943,7 @@ int aq_nic_stop(struct aq_nic_s *self)
942
943
self -> aq_vecs > i ; ++ i , aq_vec = self -> aq_vec [i ])
943
944
aq_vec_stop (aq_vec );
944
945
945
- return self -> aq_hw_ops . hw_stop (self -> aq_hw );
946
+ return self -> aq_hw_ops -> hw_stop (self -> aq_hw );
946
947
}
947
948
948
949
void aq_nic_deinit (struct aq_nic_s * self )
@@ -958,9 +959,9 @@ void aq_nic_deinit(struct aq_nic_s *self)
958
959
aq_vec_deinit (aq_vec );
959
960
960
961
if (self -> power_state == AQ_HW_POWER_STATE_D0 ) {
961
- (void )self -> aq_hw_ops . hw_deinit (self -> aq_hw );
962
+ (void )self -> aq_hw_ops -> hw_deinit (self -> aq_hw );
962
963
} else {
963
- (void )self -> aq_hw_ops . hw_set_power (self -> aq_hw ,
964
+ (void )self -> aq_hw_ops -> hw_set_power (self -> aq_hw ,
964
965
self -> power_state );
965
966
}
966
967
0 commit comments