Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sfc: move a couple more functions

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Alex Maftei (amaftei) and committed by
David S. Miller
88f7df35 3653954d

+56 -51
-33
drivers/net/ethernet/sfc/mcdi_port.c
··· 675 675 return phy_data->supported_cap; 676 676 } 677 677 678 - static unsigned int efx_mcdi_event_link_speed[] = { 679 - [MCDI_EVENT_LINKCHANGE_SPEED_100M] = 100, 680 - [MCDI_EVENT_LINKCHANGE_SPEED_1G] = 1000, 681 - [MCDI_EVENT_LINKCHANGE_SPEED_10G] = 10000, 682 - [MCDI_EVENT_LINKCHANGE_SPEED_40G] = 40000, 683 - [MCDI_EVENT_LINKCHANGE_SPEED_25G] = 25000, 684 - [MCDI_EVENT_LINKCHANGE_SPEED_50G] = 50000, 685 - [MCDI_EVENT_LINKCHANGE_SPEED_100G] = 100000, 686 - }; 687 - 688 - void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev) 689 - { 690 - u32 flags, fcntl, speed, lpa; 691 - 692 - speed = EFX_QWORD_FIELD(*ev, MCDI_EVENT_LINKCHANGE_SPEED); 693 - EFX_WARN_ON_PARANOID(speed >= ARRAY_SIZE(efx_mcdi_event_link_speed)); 694 - speed = efx_mcdi_event_link_speed[speed]; 695 - 696 - flags = EFX_QWORD_FIELD(*ev, MCDI_EVENT_LINKCHANGE_LINK_FLAGS); 697 - fcntl = EFX_QWORD_FIELD(*ev, MCDI_EVENT_LINKCHANGE_FCNTL); 698 - lpa = EFX_QWORD_FIELD(*ev, MCDI_EVENT_LINKCHANGE_LP_CAP); 699 - 700 - /* efx->link_state is only modified by efx_mcdi_phy_get_link(), 701 - * which is only run after flushing the event queues. Therefore, it 702 - * is safe to modify the link state outside of the mac_lock here. 703 - */ 704 - efx_mcdi_phy_decode_link(efx, &efx->link_state, speed, flags, fcntl); 705 - 706 - efx_mcdi_phy_check_fcntl(efx, lpa); 707 - 708 - efx_link_status_changed(efx); 709 - } 710 - 711 678 bool efx_mcdi_mac_check_fault(struct efx_nic *efx) 712 679 { 713 680 MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_LINK_OUT_LEN);
+34
drivers/net/ethernet/sfc/mcdi_port_common.c
··· 9 9 */ 10 10 11 11 #include "mcdi_port_common.h" 12 + #include "efx_common.h" 12 13 13 14 int efx_mcdi_get_phy_cfg(struct efx_nic *efx, struct efx_mcdi_phy_data *cfg) 14 15 { ··· 532 531 return rc; 533 532 534 533 return MCDI_DWORD(outbuf, GET_PORT_ASSIGNMENT_OUT_PORT); 534 + } 535 + 536 + static unsigned int efx_mcdi_event_link_speed[] = { 537 + [MCDI_EVENT_LINKCHANGE_SPEED_100M] = 100, 538 + [MCDI_EVENT_LINKCHANGE_SPEED_1G] = 1000, 539 + [MCDI_EVENT_LINKCHANGE_SPEED_10G] = 10000, 540 + [MCDI_EVENT_LINKCHANGE_SPEED_40G] = 40000, 541 + [MCDI_EVENT_LINKCHANGE_SPEED_25G] = 25000, 542 + [MCDI_EVENT_LINKCHANGE_SPEED_50G] = 50000, 543 + [MCDI_EVENT_LINKCHANGE_SPEED_100G] = 100000, 544 + }; 545 + 546 + void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev) 547 + { 548 + u32 flags, fcntl, speed, lpa; 549 + 550 + speed = EFX_QWORD_FIELD(*ev, MCDI_EVENT_LINKCHANGE_SPEED); 551 + EFX_WARN_ON_PARANOID(speed >= ARRAY_SIZE(efx_mcdi_event_link_speed)); 552 + speed = efx_mcdi_event_link_speed[speed]; 553 + 554 + flags = EFX_QWORD_FIELD(*ev, MCDI_EVENT_LINKCHANGE_LINK_FLAGS); 555 + fcntl = EFX_QWORD_FIELD(*ev, MCDI_EVENT_LINKCHANGE_FCNTL); 556 + lpa = EFX_QWORD_FIELD(*ev, MCDI_EVENT_LINKCHANGE_LP_CAP); 557 + 558 + /* efx->link_state is only modified by efx_mcdi_phy_get_link(), 559 + * which is only run after flushing the event queues. Therefore, it 560 + * is safe to modify the link state outside of the mac_lock here. 561 + */ 562 + efx_mcdi_phy_decode_link(efx, &efx->link_state, speed, flags, fcntl); 563 + 564 + efx_mcdi_phy_check_fcntl(efx, lpa); 565 + 566 + efx_link_status_changed(efx); 535 567 }
+1
drivers/net/ethernet/sfc/mcdi_port_common.h
··· 52 52 int efx_mcdi_phy_test_alive(struct efx_nic *efx); 53 53 int efx_mcdi_set_mac(struct efx_nic *efx); 54 54 int efx_mcdi_port_get_number(struct efx_nic *efx); 55 + void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev); 55 56 56 57 #endif
-18
drivers/net/ethernet/sfc/tx.c
··· 268 268 } 269 269 #endif /* EFX_USE_PIO */ 270 270 271 - /* Remove buffers put into a tx_queue for the current packet. 272 - * None of the buffers must have an skb attached. 273 - */ 274 - static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue, 275 - unsigned int insert_count) 276 - { 277 - struct efx_tx_buffer *buffer; 278 - unsigned int bytes_compl = 0; 279 - unsigned int pkts_compl = 0; 280 - 281 - /* Work backwards until we hit the original insert pointer value */ 282 - while (tx_queue->insert_count != insert_count) { 283 - --tx_queue->insert_count; 284 - buffer = __efx_tx_queue_get_insert_buffer(tx_queue); 285 - efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl); 286 - } 287 - } 288 - 289 271 /* 290 272 * Fallback to software TSO. 291 273 *
+18
drivers/net/ethernet/sfc/tx_common.c
··· 267 267 } 268 268 } 269 269 270 + /* Remove buffers put into a tx_queue for the current packet. 271 + * None of the buffers must have an skb attached. 272 + */ 273 + void efx_enqueue_unwind(struct efx_tx_queue *tx_queue, 274 + unsigned int insert_count) 275 + { 276 + struct efx_tx_buffer *buffer; 277 + unsigned int bytes_compl = 0; 278 + unsigned int pkts_compl = 0; 279 + 280 + /* Work backwards until we hit the original insert pointer value */ 281 + while (tx_queue->insert_count != insert_count) { 282 + --tx_queue->insert_count; 283 + buffer = __efx_tx_queue_get_insert_buffer(tx_queue); 284 + efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl); 285 + } 286 + } 287 + 270 288 struct efx_tx_buffer *efx_tx_map_chunk(struct efx_tx_queue *tx_queue, 271 289 dma_addr_t dma_addr, size_t len) 272 290 {
+3
drivers/net/ethernet/sfc/tx_common.h
··· 23 23 24 24 void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index); 25 25 26 + void efx_enqueue_unwind(struct efx_tx_queue *tx_queue, 27 + unsigned int insert_count); 28 + 26 29 struct efx_tx_buffer *efx_tx_map_chunk(struct efx_tx_queue *tx_queue, 27 30 dma_addr_t dma_addr, size_t len); 28 31 int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb,