diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-11-28 22:42:31 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-29 19:46:27 -0500 |
commit | ef2b90ee4dba7a3d9001f1f0003b860b39a4aaae (patch) | |
tree | 5eec233a05fab4fd0c79dc9c1eb6541d45cead53 /drivers/net/sfc/falcon.c | |
parent | 4b0d29dcfca9eafbf6e940862ab022df3ef2dd6f (diff) |
sfc: Move Falcon NIC operations to efx_nic_type
This is preparation for adding differing implementations for new NICs.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/falcon.c')
-rw-r--r-- | drivers/net/sfc/falcon.c | 79 |
1 files changed, 50 insertions, 29 deletions
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c index 040f553de665..f6d10213d0b7 100644 --- a/drivers/net/sfc/falcon.c +++ b/drivers/net/sfc/falcon.c | |||
@@ -1041,7 +1041,7 @@ int falcon_process_eventq(struct efx_channel *channel, int rx_quota) | |||
1041 | return rx_packets; | 1041 | return rx_packets; |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | void falcon_set_int_moderation(struct efx_channel *channel) | 1044 | static void falcon_push_irq_moderation(struct efx_channel *channel) |
1045 | { | 1045 | { |
1046 | efx_dword_t timer_cmd; | 1046 | efx_dword_t timer_cmd; |
1047 | struct efx_nic *efx = channel->efx; | 1047 | struct efx_nic *efx = channel->efx; |
@@ -1098,7 +1098,7 @@ void falcon_init_eventq(struct efx_channel *channel) | |||
1098 | efx_writeo_table(efx, &evq_ptr, efx->type->evq_ptr_tbl_base, | 1098 | efx_writeo_table(efx, &evq_ptr, efx->type->evq_ptr_tbl_base, |
1099 | channel->channel); | 1099 | channel->channel); |
1100 | 1100 | ||
1101 | falcon_set_int_moderation(channel); | 1101 | falcon_push_irq_moderation(channel); |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | void falcon_fini_eventq(struct efx_channel *channel) | 1104 | void falcon_fini_eventq(struct efx_channel *channel) |
@@ -1212,7 +1212,8 @@ int falcon_flush_queues(struct efx_nic *efx) | |||
1212 | struct efx_tx_queue *tx_queue; | 1212 | struct efx_tx_queue *tx_queue; |
1213 | int i, tx_pending, rx_pending; | 1213 | int i, tx_pending, rx_pending; |
1214 | 1214 | ||
1215 | falcon_prepare_flush(efx); | 1215 | /* If necessary prepare the hardware for flushing */ |
1216 | efx->type->prepare_flush(efx); | ||
1216 | 1217 | ||
1217 | /* Flush all tx queues in parallel */ | 1218 | /* Flush all tx queues in parallel */ |
1218 | efx_for_each_tx_queue(tx_queue, efx) | 1219 | efx_for_each_tx_queue(tx_queue, efx) |
@@ -1825,6 +1826,16 @@ int falcon_spi_write(const struct efx_spi_device *spi, loff_t start, | |||
1825 | ************************************************************************** | 1826 | ************************************************************************** |
1826 | */ | 1827 | */ |
1827 | 1828 | ||
1829 | static void falcon_push_multicast_hash(struct efx_nic *efx) | ||
1830 | { | ||
1831 | union efx_multicast_hash *mc_hash = &efx->multicast_hash; | ||
1832 | |||
1833 | WARN_ON(!mutex_is_locked(&efx->mac_lock)); | ||
1834 | |||
1835 | efx_writeo(efx, &mc_hash->oword[0], FR_AB_MAC_MC_HASH_REG0); | ||
1836 | efx_writeo(efx, &mc_hash->oword[1], FR_AB_MAC_MC_HASH_REG1); | ||
1837 | } | ||
1838 | |||
1828 | static int falcon_reset_macs(struct efx_nic *efx) | 1839 | static int falcon_reset_macs(struct efx_nic *efx) |
1829 | { | 1840 | { |
1830 | efx_oword_t reg; | 1841 | efx_oword_t reg; |
@@ -2240,7 +2251,7 @@ out: | |||
2240 | } | 2251 | } |
2241 | 2252 | ||
2242 | /* This call is responsible for hooking in the MAC and PHY operations */ | 2253 | /* This call is responsible for hooking in the MAC and PHY operations */ |
2243 | int falcon_probe_port(struct efx_nic *efx) | 2254 | static int falcon_probe_port(struct efx_nic *efx) |
2244 | { | 2255 | { |
2245 | int rc; | 2256 | int rc; |
2246 | 2257 | ||
@@ -2299,31 +2310,13 @@ int falcon_probe_port(struct efx_nic *efx) | |||
2299 | return 0; | 2310 | return 0; |
2300 | } | 2311 | } |
2301 | 2312 | ||
2302 | void falcon_remove_port(struct efx_nic *efx) | 2313 | static void falcon_remove_port(struct efx_nic *efx) |
2303 | { | 2314 | { |
2304 | falcon_free_buffer(efx, &efx->stats_buffer); | 2315 | falcon_free_buffer(efx, &efx->stats_buffer); |
2305 | } | 2316 | } |
2306 | 2317 | ||
2307 | /************************************************************************** | 2318 | /************************************************************************** |
2308 | * | 2319 | * |
2309 | * Multicast filtering | ||
2310 | * | ||
2311 | ************************************************************************** | ||
2312 | */ | ||
2313 | |||
2314 | void falcon_push_multicast_hash(struct efx_nic *efx) | ||
2315 | { | ||
2316 | union efx_multicast_hash *mc_hash = &efx->multicast_hash; | ||
2317 | |||
2318 | WARN_ON(!mutex_is_locked(&efx->mac_lock)); | ||
2319 | |||
2320 | efx_writeo(efx, &mc_hash->oword[0], FR_AB_MAC_MC_HASH_REG0); | ||
2321 | efx_writeo(efx, &mc_hash->oword[1], FR_AB_MAC_MC_HASH_REG1); | ||
2322 | } | ||
2323 | |||
2324 | |||
2325 | /************************************************************************** | ||
2326 | * | ||
2327 | * Falcon test code | 2320 | * Falcon test code |
2328 | * | 2321 | * |
2329 | **************************************************************************/ | 2322 | **************************************************************************/ |
@@ -2503,7 +2496,7 @@ fail: | |||
2503 | 2496 | ||
2504 | /* Resets NIC to known state. This routine must be called in process | 2497 | /* Resets NIC to known state. This routine must be called in process |
2505 | * context and is allowed to sleep. */ | 2498 | * context and is allowed to sleep. */ |
2506 | int falcon_reset_hw(struct efx_nic *efx, enum reset_type method) | 2499 | static int falcon_reset_hw(struct efx_nic *efx, enum reset_type method) |
2507 | { | 2500 | { |
2508 | struct falcon_nic_data *nic_data = efx->nic_data; | 2501 | struct falcon_nic_data *nic_data = efx->nic_data; |
2509 | efx_oword_t glb_ctl_reg_ker; | 2502 | efx_oword_t glb_ctl_reg_ker; |
@@ -2592,7 +2585,7 @@ fail5: | |||
2592 | return rc; | 2585 | return rc; |
2593 | } | 2586 | } |
2594 | 2587 | ||
2595 | void falcon_monitor(struct efx_nic *efx) | 2588 | static void falcon_monitor(struct efx_nic *efx) |
2596 | { | 2589 | { |
2597 | bool link_changed; | 2590 | bool link_changed; |
2598 | int rc; | 2591 | int rc; |
@@ -2850,7 +2843,7 @@ static void falcon_probe_spi_devices(struct efx_nic *efx) | |||
2850 | large_eeprom_type); | 2843 | large_eeprom_type); |
2851 | } | 2844 | } |
2852 | 2845 | ||
2853 | int falcon_probe_nic(struct efx_nic *efx) | 2846 | static int falcon_probe_nic(struct efx_nic *efx) |
2854 | { | 2847 | { |
2855 | struct falcon_nic_data *nic_data; | 2848 | struct falcon_nic_data *nic_data; |
2856 | struct falcon_board *board; | 2849 | struct falcon_board *board; |
@@ -3006,7 +2999,7 @@ static void falcon_init_rx_cfg(struct efx_nic *efx) | |||
3006 | * defining the descriptor cache sizes and number of RSS channels. | 2999 | * defining the descriptor cache sizes and number of RSS channels. |
3007 | * It does not set up any buffers, descriptor rings or event queues. | 3000 | * It does not set up any buffers, descriptor rings or event queues. |
3008 | */ | 3001 | */ |
3009 | int falcon_init_nic(struct efx_nic *efx) | 3002 | static int falcon_init_nic(struct efx_nic *efx) |
3010 | { | 3003 | { |
3011 | efx_oword_t temp; | 3004 | efx_oword_t temp; |
3012 | int rc; | 3005 | int rc; |
@@ -3139,7 +3132,7 @@ int falcon_init_nic(struct efx_nic *efx) | |||
3139 | return 0; | 3132 | return 0; |
3140 | } | 3133 | } |
3141 | 3134 | ||
3142 | void falcon_remove_nic(struct efx_nic *efx) | 3135 | static void falcon_remove_nic(struct efx_nic *efx) |
3143 | { | 3136 | { |
3144 | struct falcon_nic_data *nic_data = efx->nic_data; | 3137 | struct falcon_nic_data *nic_data = efx->nic_data; |
3145 | struct falcon_board *board = falcon_board(efx); | 3138 | struct falcon_board *board = falcon_board(efx); |
@@ -3168,7 +3161,7 @@ void falcon_remove_nic(struct efx_nic *efx) | |||
3168 | efx->nic_data = NULL; | 3161 | efx->nic_data = NULL; |
3169 | } | 3162 | } |
3170 | 3163 | ||
3171 | void falcon_update_nic_stats(struct efx_nic *efx) | 3164 | static void falcon_update_nic_stats(struct efx_nic *efx) |
3172 | { | 3165 | { |
3173 | struct falcon_nic_data *nic_data = efx->nic_data; | 3166 | struct falcon_nic_data *nic_data = efx->nic_data; |
3174 | efx_oword_t cnt; | 3167 | efx_oword_t cnt; |
@@ -3232,6 +3225,20 @@ void falcon_stop_nic_stats(struct efx_nic *efx) | |||
3232 | */ | 3225 | */ |
3233 | 3226 | ||
3234 | struct efx_nic_type falcon_a1_nic_type = { | 3227 | struct efx_nic_type falcon_a1_nic_type = { |
3228 | .probe = falcon_probe_nic, | ||
3229 | .remove = falcon_remove_nic, | ||
3230 | .init = falcon_init_nic, | ||
3231 | .fini = efx_port_dummy_op_void, | ||
3232 | .monitor = falcon_monitor, | ||
3233 | .reset = falcon_reset_hw, | ||
3234 | .probe_port = falcon_probe_port, | ||
3235 | .remove_port = falcon_remove_port, | ||
3236 | .prepare_flush = falcon_prepare_flush, | ||
3237 | .update_stats = falcon_update_nic_stats, | ||
3238 | .start_stats = falcon_start_nic_stats, | ||
3239 | .stop_stats = falcon_stop_nic_stats, | ||
3240 | .push_irq_moderation = falcon_push_irq_moderation, | ||
3241 | .push_multicast_hash = falcon_push_multicast_hash, | ||
3235 | .default_mac_ops = &falcon_xmac_operations, | 3242 | .default_mac_ops = &falcon_xmac_operations, |
3236 | 3243 | ||
3237 | .revision = EFX_REV_FALCON_A1, | 3244 | .revision = EFX_REV_FALCON_A1, |
@@ -3250,6 +3257,20 @@ struct efx_nic_type falcon_a1_nic_type = { | |||
3250 | }; | 3257 | }; |
3251 | 3258 | ||
3252 | struct efx_nic_type falcon_b0_nic_type = { | 3259 | struct efx_nic_type falcon_b0_nic_type = { |
3260 | .probe = falcon_probe_nic, | ||
3261 | .remove = falcon_remove_nic, | ||
3262 | .init = falcon_init_nic, | ||
3263 | .fini = efx_port_dummy_op_void, | ||
3264 | .monitor = falcon_monitor, | ||
3265 | .reset = falcon_reset_hw, | ||
3266 | .probe_port = falcon_probe_port, | ||
3267 | .remove_port = falcon_remove_port, | ||
3268 | .prepare_flush = falcon_prepare_flush, | ||
3269 | .update_stats = falcon_update_nic_stats, | ||
3270 | .start_stats = falcon_start_nic_stats, | ||
3271 | .stop_stats = falcon_stop_nic_stats, | ||
3272 | .push_irq_moderation = falcon_push_irq_moderation, | ||
3273 | .push_multicast_hash = falcon_push_multicast_hash, | ||
3253 | .default_mac_ops = &falcon_xmac_operations, | 3274 | .default_mac_ops = &falcon_xmac_operations, |
3254 | 3275 | ||
3255 | .revision = EFX_REV_FALCON_B0, | 3276 | .revision = EFX_REV_FALCON_B0, |