@@ -43,6 +43,11 @@ static const struct wx_stats wx_gstrings_stats[] = {
43
43
WX_STAT ("alloc_rx_buff_failed" , alloc_rx_buff_failed ),
44
44
};
45
45
46
+ static const struct wx_stats wx_gstrings_fdir_stats [] = {
47
+ WX_STAT ("fdir_match" , stats .fdirmatch ),
48
+ WX_STAT ("fdir_miss" , stats .fdirmiss ),
49
+ };
50
+
46
51
/* drivers allocates num_tx_queues and num_rx_queues symmetrically so
47
52
* we set the num_rx_queues to evaluate to num_tx_queues. This is
48
53
* used because we do not have a good way to get the max number of
@@ -55,13 +60,17 @@ static const struct wx_stats wx_gstrings_stats[] = {
55
60
(WX_NUM_TX_QUEUES + WX_NUM_RX_QUEUES) * \
56
61
(sizeof(struct wx_queue_stats) / sizeof(u64)))
57
62
#define WX_GLOBAL_STATS_LEN ARRAY_SIZE(wx_gstrings_stats)
63
+ #define WX_FDIR_STATS_LEN ARRAY_SIZE(wx_gstrings_fdir_stats)
58
64
#define WX_STATS_LEN (WX_GLOBAL_STATS_LEN + WX_QUEUE_STATS_LEN)
59
65
60
66
int wx_get_sset_count (struct net_device * netdev , int sset )
61
67
{
68
+ struct wx * wx = netdev_priv (netdev );
69
+
62
70
switch (sset ) {
63
71
case ETH_SS_STATS :
64
- return WX_STATS_LEN ;
72
+ return (wx -> mac .type == wx_mac_sp ) ?
73
+ WX_STATS_LEN + WX_FDIR_STATS_LEN : WX_STATS_LEN ;
65
74
default :
66
75
return - EOPNOTSUPP ;
67
76
}
@@ -70,13 +79,18 @@ EXPORT_SYMBOL(wx_get_sset_count);
70
79
71
80
void wx_get_strings (struct net_device * netdev , u32 stringset , u8 * data )
72
81
{
82
+ struct wx * wx = netdev_priv (netdev );
73
83
u8 * p = data ;
74
84
int i ;
75
85
76
86
switch (stringset ) {
77
87
case ETH_SS_STATS :
78
88
for (i = 0 ; i < WX_GLOBAL_STATS_LEN ; i ++ )
79
89
ethtool_puts (& p , wx_gstrings_stats [i ].stat_string );
90
+ if (wx -> mac .type == wx_mac_sp ) {
91
+ for (i = 0 ; i < WX_FDIR_STATS_LEN ; i ++ )
92
+ ethtool_puts (& p , wx_gstrings_fdir_stats [i ].stat_string );
93
+ }
80
94
for (i = 0 ; i < netdev -> num_tx_queues ; i ++ ) {
81
95
ethtool_sprintf (& p , "tx_queue_%u_packets" , i );
82
96
ethtool_sprintf (& p , "tx_queue_%u_bytes" , i );
@@ -96,7 +110,7 @@ void wx_get_ethtool_stats(struct net_device *netdev,
96
110
struct wx * wx = netdev_priv (netdev );
97
111
struct wx_ring * ring ;
98
112
unsigned int start ;
99
- int i , j ;
113
+ int i , j , k ;
100
114
char * p ;
101
115
102
116
wx_update_stats (wx );
@@ -107,6 +121,13 @@ void wx_get_ethtool_stats(struct net_device *netdev,
107
121
sizeof (u64 )) ? * (u64 * )p : * (u32 * )p ;
108
122
}
109
123
124
+ if (wx -> mac .type == wx_mac_sp ) {
125
+ for (k = 0 ; k < WX_FDIR_STATS_LEN ; k ++ ) {
126
+ p = (char * )wx + wx_gstrings_fdir_stats [k ].stat_offset ;
127
+ data [i ++ ] = * (u64 * )p ;
128
+ }
129
+ }
130
+
110
131
for (j = 0 ; j < netdev -> num_tx_queues ; j ++ ) {
111
132
ring = wx -> tx_ring [j ];
112
133
if (!ring ) {
@@ -172,17 +193,21 @@ EXPORT_SYMBOL(wx_get_pause_stats);
172
193
173
194
void wx_get_drvinfo (struct net_device * netdev , struct ethtool_drvinfo * info )
174
195
{
196
+ unsigned int stats_len = WX_STATS_LEN ;
175
197
struct wx * wx = netdev_priv (netdev );
176
198
199
+ if (wx -> mac .type == wx_mac_sp )
200
+ stats_len += WX_FDIR_STATS_LEN ;
201
+
177
202
strscpy (info -> driver , wx -> driver_name , sizeof (info -> driver ));
178
203
strscpy (info -> fw_version , wx -> eeprom_id , sizeof (info -> fw_version ));
179
204
strscpy (info -> bus_info , pci_name (wx -> pdev ), sizeof (info -> bus_info ));
180
205
if (wx -> num_tx_queues <= WX_NUM_TX_QUEUES ) {
181
- info -> n_stats = WX_STATS_LEN -
206
+ info -> n_stats = stats_len -
182
207
(WX_NUM_TX_QUEUES - wx -> num_tx_queues ) *
183
208
(sizeof (struct wx_queue_stats ) / sizeof (u64 )) * 2 ;
184
209
} else {
185
- info -> n_stats = WX_STATS_LEN ;
210
+ info -> n_stats = stats_len ;
186
211
}
187
212
}
188
213
EXPORT_SYMBOL (wx_get_drvinfo );
@@ -383,6 +408,9 @@ void wx_get_channels(struct net_device *dev,
383
408
384
409
/* record RSS queues */
385
410
ch -> combined_count = wx -> ring_feature [RING_F_RSS ].indices ;
411
+
412
+ if (test_bit (WX_FLAG_FDIR_CAPABLE , wx -> flags ))
413
+ ch -> combined_count = wx -> ring_feature [RING_F_FDIR ].indices ;
386
414
}
387
415
EXPORT_SYMBOL (wx_get_channels );
388
416
@@ -400,6 +428,9 @@ int wx_set_channels(struct net_device *dev,
400
428
if (count > wx_max_channels (wx ))
401
429
return - EINVAL ;
402
430
431
+ if (test_bit (WX_FLAG_FDIR_CAPABLE , wx -> flags ))
432
+ wx -> ring_feature [RING_F_FDIR ].limit = count ;
433
+
403
434
wx -> ring_feature [RING_F_RSS ].limit = count ;
404
435
405
436
return 0 ;
0 commit comments