Lines Matching refs:p_hwfn

68 static u8 qed_ll2_handle_to_stats_id(struct qed_hwfn *p_hwfn,  in qed_ll2_handle_to_stats_id()  argument
83 stats_id = MAX_NUM_LL2_RX_RAM_QUEUES + p_hwfn->abs_pf_id; in qed_ll2_handle_to_stats_id()
98 struct qed_hwfn *p_hwfn = cxt; in qed_ll2b_complete_tx_packet() local
99 struct qed_dev *cdev = p_hwfn->cdev; in qed_ll2b_complete_tx_packet()
103 dma_unmap_single(&p_hwfn->cdev->pdev->dev, first_frag_addr, in qed_ll2b_complete_tx_packet()
164 struct qed_hwfn *p_hwfn = cxt; in qed_ll2b_complete_rx_packet() local
166 struct qed_dev *cdev = p_hwfn->cdev; in qed_ll2b_complete_rx_packet()
173 DP_VERBOSE(p_hwfn, in qed_ll2b_complete_rx_packet()
194 rc = qed_ll2_alloc_buffer(p_hwfn->cdev, &new_data, in qed_ll2b_complete_rx_packet()
230 DP_VERBOSE(p_hwfn, (NETIF_MSG_RX_STATUS | NETIF_MSG_PKTDATA | in qed_ll2b_complete_rx_packet()
242 rc = qed_ll2_post_rx_buffer(p_hwfn, cdev->ll2->handle, in qed_ll2b_complete_rx_packet()
248 static struct qed_ll2_info *__qed_ll2_handle_sanity(struct qed_hwfn *p_hwfn, in __qed_ll2_handle_sanity() argument
258 if (!p_hwfn->p_ll2_info) in __qed_ll2_handle_sanity()
261 p_ll2_conn = &p_hwfn->p_ll2_info[connection_handle]; in __qed_ll2_handle_sanity()
277 static struct qed_ll2_info *qed_ll2_handle_sanity(struct qed_hwfn *p_hwfn, in qed_ll2_handle_sanity() argument
280 return __qed_ll2_handle_sanity(p_hwfn, connection_handle, false, true); in qed_ll2_handle_sanity()
283 static struct qed_ll2_info *qed_ll2_handle_sanity_lock(struct qed_hwfn *p_hwfn, in qed_ll2_handle_sanity_lock() argument
286 return __qed_ll2_handle_sanity(p_hwfn, connection_handle, true, true); in qed_ll2_handle_sanity_lock()
290 *p_hwfn, in qed_ll2_handle_sanity_inactive() argument
293 return __qed_ll2_handle_sanity(p_hwfn, connection_handle, false, false); in qed_ll2_handle_sanity_inactive()
296 static void qed_ll2_txq_flush(struct qed_hwfn *p_hwfn, u8 connection_handle) in qed_ll2_txq_flush() argument
305 p_ll2_conn = qed_ll2_handle_sanity_inactive(p_hwfn, connection_handle); in qed_ll2_txq_flush()
326 qed_ooo_put_free_buffer(p_hwfn, p_hwfn->p_ooo_info, in qed_ll2_txq_flush()
346 static int qed_ll2_txq_completion(struct qed_hwfn *p_hwfn, void *p_cookie) in qed_ll2_txq_completion() argument
382 DP_NOTICE(p_hwfn, in qed_ll2_txq_completion()
414 static void qed_ll2_rxq_parse_gsi(struct qed_hwfn *p_hwfn, in qed_ll2_rxq_parse_gsi() argument
429 static void qed_ll2_rxq_parse_reg(struct qed_hwfn *p_hwfn, in qed_ll2_rxq_parse_reg() argument
444 qed_ll2_handle_slowpath(struct qed_hwfn *p_hwfn, in qed_ll2_handle_slowpath() argument
454 DP_NOTICE(p_hwfn, in qed_ll2_handle_slowpath()
461 DP_NOTICE(p_hwfn, in qed_ll2_handle_slowpath()
479 qed_ll2_rxq_handle_completion(struct qed_hwfn *p_hwfn, in qed_ll2_rxq_handle_completion() argument
492 DP_NOTICE(p_hwfn, in qed_ll2_rxq_handle_completion()
501 qed_ll2_rxq_parse_reg(p_hwfn, p_cqe, &data); in qed_ll2_rxq_handle_completion()
503 qed_ll2_rxq_parse_gsi(p_hwfn, p_cqe, &data); in qed_ll2_rxq_handle_completion()
505 DP_NOTICE(p_hwfn, in qed_ll2_rxq_handle_completion()
523 static int qed_ll2_rxq_completion(struct qed_hwfn *p_hwfn, void *cookie) in qed_ll2_rxq_completion() argument
553 DP_VERBOSE(p_hwfn, in qed_ll2_rxq_completion()
560 rc = qed_ll2_handle_slowpath(p_hwfn, p_ll2_conn, in qed_ll2_rxq_completion()
565 rc = qed_ll2_rxq_handle_completion(p_hwfn, p_ll2_conn, in qed_ll2_rxq_completion()
578 static void qed_ll2_rxq_flush(struct qed_hwfn *p_hwfn, u8 connection_handle) in qed_ll2_rxq_flush() argument
585 p_ll2_conn = qed_ll2_handle_sanity_inactive(p_hwfn, connection_handle); in qed_ll2_rxq_flush()
604 qed_ooo_put_free_buffer(p_hwfn, p_hwfn->p_ooo_info, in qed_ll2_rxq_flush()
623 qed_ll2_lb_rxq_handler_slowpath(struct qed_hwfn *p_hwfn, in qed_ll2_lb_rxq_handler_slowpath() argument
638 qed_ooo_release_connection_isles(p_hwfn, p_hwfn->p_ooo_info, cid); in qed_ll2_lb_rxq_handler_slowpath()
643 static int qed_ll2_lb_rxq_handler(struct qed_hwfn *p_hwfn, in qed_ll2_lb_rxq_handler() argument
670 if (qed_ll2_lb_rxq_handler_slowpath(p_hwfn, in qed_ll2_lb_rxq_handler()
675 DP_NOTICE(p_hwfn, in qed_ll2_lb_rxq_handler()
687 qed_ooo_save_history_entry(p_hwfn, p_hwfn->p_ooo_info, ooo_opq); in qed_ll2_lb_rxq_handler()
692 qed_ooo_delete_isles(p_hwfn, p_hwfn->p_ooo_info, cid, in qed_ll2_lb_rxq_handler()
701 DP_NOTICE(p_hwfn, in qed_ll2_lb_rxq_handler()
716 DP_NOTICE(p_hwfn, in qed_ll2_lb_rxq_handler()
731 qed_ooo_add_new_isle(p_hwfn, in qed_ll2_lb_rxq_handler()
732 p_hwfn->p_ooo_info, in qed_ll2_lb_rxq_handler()
738 qed_ooo_add_new_buffer(p_hwfn, in qed_ll2_lb_rxq_handler()
739 p_hwfn->p_ooo_info, in qed_ll2_lb_rxq_handler()
746 qed_ooo_add_new_buffer(p_hwfn, in qed_ll2_lb_rxq_handler()
747 p_hwfn->p_ooo_info, in qed_ll2_lb_rxq_handler()
754 qed_ooo_add_new_buffer(p_hwfn, in qed_ll2_lb_rxq_handler()
755 p_hwfn->p_ooo_info, in qed_ll2_lb_rxq_handler()
760 qed_ooo_join_isles(p_hwfn, in qed_ll2_lb_rxq_handler()
761 p_hwfn->p_ooo_info, in qed_ll2_lb_rxq_handler()
766 qed_ooo_put_ready_buffer(p_hwfn, in qed_ll2_lb_rxq_handler()
767 p_hwfn->p_ooo_info, in qed_ll2_lb_rxq_handler()
772 DP_NOTICE(p_hwfn, in qed_ll2_lb_rxq_handler()
782 qed_ooo_submit_tx_buffers(struct qed_hwfn *p_hwfn, in qed_ooo_submit_tx_buffers() argument
793 while ((p_buffer = qed_ooo_get_ready_buffer(p_hwfn, in qed_ooo_submit_tx_buffers()
794 p_hwfn->p_ooo_info))) { in qed_ooo_submit_tx_buffers()
824 rc = qed_ll2_prepare_tx_packet(p_hwfn, p_ll2_conn->my_id, in qed_ooo_submit_tx_buffers()
827 qed_ooo_put_ready_buffer(p_hwfn, p_hwfn->p_ooo_info, in qed_ooo_submit_tx_buffers()
835 qed_ooo_submit_rx_buffers(struct qed_hwfn *p_hwfn, in qed_ooo_submit_rx_buffers() argument
841 while ((p_buffer = qed_ooo_get_free_buffer(p_hwfn, in qed_ooo_submit_rx_buffers()
842 p_hwfn->p_ooo_info))) { in qed_ooo_submit_rx_buffers()
843 rc = qed_ll2_post_rx_buffer(p_hwfn, in qed_ooo_submit_rx_buffers()
848 qed_ooo_put_free_buffer(p_hwfn, in qed_ooo_submit_rx_buffers()
849 p_hwfn->p_ooo_info, p_buffer); in qed_ooo_submit_rx_buffers()
855 static int qed_ll2_lb_rxq_completion(struct qed_hwfn *p_hwfn, void *p_cookie) in qed_ll2_lb_rxq_completion() argument
866 rc = qed_ll2_lb_rxq_handler(p_hwfn, p_ll2_conn); in qed_ll2_lb_rxq_completion()
870 qed_ooo_submit_rx_buffers(p_hwfn, p_ll2_conn); in qed_ll2_lb_rxq_completion()
871 qed_ooo_submit_tx_buffers(p_hwfn, p_ll2_conn); in qed_ll2_lb_rxq_completion()
876 static int qed_ll2_lb_txq_completion(struct qed_hwfn *p_hwfn, void *p_cookie) in qed_ll2_lb_txq_completion() argument
908 DP_NOTICE(p_hwfn, in qed_ll2_lb_txq_completion()
924 qed_ooo_put_free_buffer(p_hwfn, p_hwfn->p_ooo_info, in qed_ll2_lb_txq_completion()
929 rc = qed_ll2_post_rx_buffer(p_hwfn, p_ll2_conn->my_id, in qed_ll2_lb_txq_completion()
933 qed_ooo_put_free_buffer(p_hwfn, in qed_ll2_lb_txq_completion()
934 p_hwfn->p_ooo_info, p_buffer); in qed_ll2_lb_txq_completion()
939 qed_ooo_submit_tx_buffers(p_hwfn, p_ll2_conn); in qed_ll2_lb_txq_completion()
944 static void qed_ll2_stop_ooo(struct qed_hwfn *p_hwfn) in qed_ll2_stop_ooo() argument
946 u8 *handle = &p_hwfn->pf_params.iscsi_pf_params.ll2_ooo_queue_id; in qed_ll2_stop_ooo()
948 DP_VERBOSE(p_hwfn, (QED_MSG_STORAGE | QED_MSG_LL2), in qed_ll2_stop_ooo()
951 qed_ll2_terminate_connection(p_hwfn, *handle); in qed_ll2_stop_ooo()
952 qed_ll2_release_connection(p_hwfn, *handle); in qed_ll2_stop_ooo()
956 static int qed_sp_ll2_rx_queue_start(struct qed_hwfn *p_hwfn, in qed_sp_ll2_rx_queue_start() argument
971 init_data.opaque_fid = p_hwfn->hw_info.opaque_fid; in qed_sp_ll2_rx_queue_start()
974 rc = qed_sp_init_request(p_hwfn, &p_ent, in qed_sp_ll2_rx_queue_start()
982 p_ramrod->sb_id = cpu_to_le16(qed_int_get_sp_sb_id(p_hwfn)); in qed_sp_ll2_rx_queue_start()
997 if (test_bit(QED_MF_UFP_SPECIFIC, &p_hwfn->cdev->mf_bits) && in qed_sp_ll2_rx_queue_start()
1003 if (test_bit(QED_MF_LL2_NON_UNICAST, &p_hwfn->cdev->mf_bits) && in qed_sp_ll2_rx_queue_start()
1006 (!QED_IS_NVMETCP_PERSONALITY(p_hwfn))) { in qed_sp_ll2_rx_queue_start()
1018 return qed_spq_post(p_hwfn, p_ent, NULL); in qed_sp_ll2_rx_queue_start()
1021 static int qed_sp_ll2_tx_queue_start(struct qed_hwfn *p_hwfn, in qed_sp_ll2_tx_queue_start() argument
1043 init_data.opaque_fid = p_hwfn->hw_info.opaque_fid; in qed_sp_ll2_tx_queue_start()
1046 rc = qed_sp_init_request(p_hwfn, &p_ent, in qed_sp_ll2_tx_queue_start()
1054 p_ramrod->sb_id = cpu_to_le16(qed_int_get_sp_sb_id(p_hwfn)); in qed_sp_ll2_tx_queue_start()
1067 pq_id = qed_get_cm_pq_idx(p_hwfn, PQ_FLAGS_LB); in qed_sp_ll2_tx_queue_start()
1070 pq_id = qed_get_cm_pq_idx(p_hwfn, PQ_FLAGS_OOO); in qed_sp_ll2_tx_queue_start()
1073 pq_id = qed_get_cm_pq_idx(p_hwfn, PQ_FLAGS_OFLD); in qed_sp_ll2_tx_queue_start()
1093 if (p_hwfn->hw_info.personality == QED_PCI_ISCSI || in qed_sp_ll2_tx_queue_start()
1094 p_hwfn->hw_info.personality == QED_PCI_NVMETCP) in qed_sp_ll2_tx_queue_start()
1101 DP_NOTICE(p_hwfn, "Unknown connection type: %d\n", conn_type); in qed_sp_ll2_tx_queue_start()
1106 rc = qed_spq_post(p_hwfn, p_ent, NULL); in qed_sp_ll2_tx_queue_start()
1110 rc = qed_db_recovery_add(p_hwfn->cdev, p_tx->doorbell_addr, in qed_sp_ll2_tx_queue_start()
1116 static int qed_sp_ll2_rx_queue_stop(struct qed_hwfn *p_hwfn, in qed_sp_ll2_rx_queue_stop() argument
1127 init_data.opaque_fid = p_hwfn->hw_info.opaque_fid; in qed_sp_ll2_rx_queue_stop()
1130 rc = qed_sp_init_request(p_hwfn, &p_ent, in qed_sp_ll2_rx_queue_stop()
1141 return qed_spq_post(p_hwfn, p_ent, NULL); in qed_sp_ll2_rx_queue_stop()
1144 static int qed_sp_ll2_tx_queue_stop(struct qed_hwfn *p_hwfn, in qed_sp_ll2_tx_queue_stop() argument
1152 qed_db_recovery_del(p_hwfn->cdev, p_tx->doorbell_addr, &p_tx->db_msg); in qed_sp_ll2_tx_queue_stop()
1157 init_data.opaque_fid = p_hwfn->hw_info.opaque_fid; in qed_sp_ll2_tx_queue_stop()
1160 rc = qed_sp_init_request(p_hwfn, &p_ent, in qed_sp_ll2_tx_queue_stop()
1166 return qed_spq_post(p_hwfn, p_ent, NULL); in qed_sp_ll2_tx_queue_stop()
1170 qed_ll2_acquire_connection_rx(struct qed_hwfn *p_hwfn, in qed_ll2_acquire_connection_rx() argument
1178 struct qed_dev *cdev = p_hwfn->cdev; in qed_ll2_acquire_connection_rx()
1191 DP_NOTICE(p_hwfn, "Failed to allocate ll2 rxq chain\n"); in qed_ll2_acquire_connection_rx()
1200 DP_NOTICE(p_hwfn, "Failed to allocate ll2 Rx desc\n"); in qed_ll2_acquire_connection_rx()
1210 DP_NOTICE(p_hwfn, "Failed to allocate ll2 rcq chain\n"); in qed_ll2_acquire_connection_rx()
1214 DP_VERBOSE(p_hwfn, QED_MSG_LL2, in qed_ll2_acquire_connection_rx()
1222 static int qed_ll2_acquire_connection_tx(struct qed_hwfn *p_hwfn, in qed_ll2_acquire_connection_tx() argument
1240 rc = qed_chain_alloc(p_hwfn->cdev, &p_ll2_info->tx_queue.txq_chain, in qed_ll2_acquire_connection_tx()
1257 DP_VERBOSE(p_hwfn, QED_MSG_LL2, in qed_ll2_acquire_connection_tx()
1263 DP_NOTICE(p_hwfn, in qed_ll2_acquire_connection_tx()
1270 qed_ll2_acquire_connection_ooo(struct qed_hwfn *p_hwfn, in qed_ll2_acquire_connection_ooo() argument
1302 p_virt = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev, in qed_ll2_acquire_connection_ooo()
1313 qed_ooo_put_free_buffer(p_hwfn, p_hwfn->p_ooo_info, p_buf); in qed_ll2_acquire_connection_ooo()
1316 DP_VERBOSE(p_hwfn, QED_MSG_LL2, in qed_ll2_acquire_connection_ooo()
1342 static void _qed_ll2_calc_allowed_conns(struct qed_hwfn *p_hwfn, in _qed_ll2_calc_allowed_conns() argument
1378 struct qed_hwfn *p_hwfn = cxt; in qed_ll2_acquire_connection() local
1384 if (!data->p_connection_handle || !p_hwfn->p_ll2_info) in qed_ll2_acquire_connection()
1387 _qed_ll2_calc_allowed_conns(p_hwfn, data, &first_idx, &last_idx); in qed_ll2_acquire_connection()
1391 mutex_lock(&p_hwfn->p_ll2_info[i].mutex); in qed_ll2_acquire_connection()
1392 if (p_hwfn->p_ll2_info[i].b_active) { in qed_ll2_acquire_connection()
1393 mutex_unlock(&p_hwfn->p_ll2_info[i].mutex); in qed_ll2_acquire_connection()
1397 p_hwfn->p_ll2_info[i].b_active = true; in qed_ll2_acquire_connection()
1398 p_ll2_info = &p_hwfn->p_ll2_info[i]; in qed_ll2_acquire_connection()
1399 mutex_unlock(&p_hwfn->p_ll2_info[i].mutex); in qed_ll2_acquire_connection()
1437 DP_NOTICE(p_hwfn, "Invalid callback functions\n"); in qed_ll2_acquire_connection()
1441 rc = qed_ll2_acquire_connection_rx(p_hwfn, p_ll2_info); in qed_ll2_acquire_connection()
1445 rc = qed_ll2_acquire_connection_tx(p_hwfn, p_ll2_info); in qed_ll2_acquire_connection()
1449 rc = qed_ll2_acquire_connection_ooo(p_hwfn, p_ll2_info, in qed_ll2_acquire_connection()
1464 qed_int_register_cb(p_hwfn, comp_rx_cb, in qed_ll2_acquire_connection()
1465 &p_hwfn->p_ll2_info[i], in qed_ll2_acquire_connection()
1472 qed_int_register_cb(p_hwfn, in qed_ll2_acquire_connection()
1474 &p_hwfn->p_ll2_info[i], in qed_ll2_acquire_connection()
1484 qed_ll2_release_connection(p_hwfn, i); in qed_ll2_acquire_connection()
1488 static int qed_ll2_establish_connection_rx(struct qed_hwfn *p_hwfn, in qed_ll2_establish_connection_rx() argument
1508 rc = qed_sp_ll2_rx_queue_start(p_hwfn, p_ll2_conn, action_on_error); in qed_ll2_establish_connection_rx()
1513 rc = qed_db_recovery_add(p_hwfn->cdev, in qed_ll2_establish_connection_rx()
1523 qed_ll2_establish_connection_ooo(struct qed_hwfn *p_hwfn, in qed_ll2_establish_connection_ooo() argument
1529 qed_ooo_release_all_isles(p_hwfn, p_hwfn->p_ooo_info); in qed_ll2_establish_connection_ooo()
1530 qed_ooo_submit_rx_buffers(p_hwfn, p_ll2_conn); in qed_ll2_establish_connection_ooo()
1533 static inline u8 qed_ll2_handle_to_queue_id(struct qed_hwfn *p_hwfn, in qed_ll2_handle_to_queue_id() argument
1540 return p_hwfn->hw_info.resc_start[QED_LL2_RAM_QUEUE] + handle; in qed_ll2_handle_to_queue_id()
1548 qid = p_hwfn->hw_info.resc_start[QED_LL2_CTX_QUEUE] + in qed_ll2_handle_to_queue_id()
1564 struct qed_hwfn *p_hwfn = cxt; in qed_ll2_establish_connection() local
1574 p_ptt = qed_ptt_acquire(p_hwfn); in qed_ll2_establish_connection()
1578 p_ll2_conn = qed_ll2_handle_sanity_lock(p_hwfn, connection_handle); in qed_ll2_establish_connection()
1621 rc = qed_cxt_acquire_cid(p_hwfn, PROTOCOLID_CORE, &p_ll2_conn->cid); in qed_ll2_establish_connection()
1625 rc = qed_cxt_get_cid_info(p_hwfn, &cxt_info); in qed_ll2_establish_connection()
1627 DP_NOTICE(p_hwfn, "Cannot find context info for cid=%d\n", in qed_ll2_establish_connection()
1636 qid = qed_ll2_handle_to_queue_id(p_hwfn, connection_handle, in qed_ll2_establish_connection()
1638 stats_id = qed_ll2_handle_to_stats_id(p_hwfn, in qed_ll2_establish_connection()
1647 DP_VERBOSE(p_hwfn, in qed_ll2_establish_connection()
1653 DP_VERBOSE(p_hwfn, in qed_ll2_establish_connection()
1656 p_hwfn->rel_pf_id, in qed_ll2_establish_connection()
1661 (u8 __iomem *)p_hwfn->regview + in qed_ll2_establish_connection()
1668 p_rx->set_prod_addr = p_hwfn->doorbells + in qed_ll2_establish_connection()
1669 p_hwfn->dpi_start_offset + in qed_ll2_establish_connection()
1680 p_tx->doorbell_addr = (u8 __iomem *)p_hwfn->doorbells + in qed_ll2_establish_connection()
1690 rc = qed_ll2_establish_connection_rx(p_hwfn, p_ll2_conn); in qed_ll2_establish_connection()
1694 rc = qed_sp_ll2_tx_queue_start(p_hwfn, p_ll2_conn); in qed_ll2_establish_connection()
1698 if (!QED_IS_RDMA_PERSONALITY(p_hwfn) && in qed_ll2_establish_connection()
1699 !QED_IS_NVMETCP_PERSONALITY(p_hwfn)) in qed_ll2_establish_connection()
1700 qed_wr(p_hwfn, p_ptt, PRS_REG_USE_LIGHT_L2, 1); in qed_ll2_establish_connection()
1702 qed_ll2_establish_connection_ooo(p_hwfn, p_ll2_conn); in qed_ll2_establish_connection()
1705 if (!test_bit(QED_MF_UFP_SPECIFIC, &p_hwfn->cdev->mf_bits)) in qed_ll2_establish_connection()
1706 qed_llh_add_protocol_filter(p_hwfn->cdev, 0, in qed_ll2_establish_connection()
1709 qed_llh_add_protocol_filter(p_hwfn->cdev, 0, in qed_ll2_establish_connection()
1715 qed_ptt_release(p_hwfn, p_ptt); in qed_ll2_establish_connection()
1719 static void qed_ll2_post_rx_buffer_notify_fw(struct qed_hwfn *p_hwfn, in qed_ll2_post_rx_buffer_notify_fw() argument
1777 struct qed_hwfn *p_hwfn = cxt; in qed_ll2_post_rx_buffer() local
1786 p_ll2_conn = qed_ll2_handle_sanity(p_hwfn, connection_handle); in qed_ll2_post_rx_buffer()
1829 qed_ll2_post_rx_buffer_notify_fw(p_hwfn, p_rx, p_curp); in qed_ll2_post_rx_buffer()
1835 static void qed_ll2_prepare_tx_packet_set(struct qed_hwfn *p_hwfn, in qed_ll2_prepare_tx_packet_set() argument
1854 qed_ll2_prepare_tx_packet_set_bd(struct qed_hwfn *p_hwfn, in qed_ll2_prepare_tx_packet_set_bd() argument
1886 if (likely(QED_IS_IWARP_PERSONALITY(p_hwfn) && in qed_ll2_prepare_tx_packet_set_bd()
1892 if (test_bit(QED_MF_UFP_SPECIFIC, &p_hwfn->cdev->mf_bits) && in qed_ll2_prepare_tx_packet_set_bd()
1916 DP_VERBOSE(p_hwfn, in qed_ll2_prepare_tx_packet_set_bd()
1945 static void qed_ll2_tx_packet_notify(struct qed_hwfn *p_hwfn, in qed_ll2_tx_packet_notify() argument
1986 DP_VERBOSE(p_hwfn, in qed_ll2_tx_packet_notify()
1999 struct qed_hwfn *p_hwfn = cxt; in qed_ll2_prepare_tx_packet() local
2007 p_ll2_conn = qed_ll2_handle_sanity(p_hwfn, connection_handle); in qed_ll2_prepare_tx_packet()
2036 qed_ll2_prepare_tx_packet_set(p_hwfn, p_tx, p_curp, pkt, notify_fw); in qed_ll2_prepare_tx_packet()
2038 qed_ll2_prepare_tx_packet_set_bd(p_hwfn, p_ll2_conn, p_curp, pkt); in qed_ll2_prepare_tx_packet()
2040 qed_ll2_tx_packet_notify(p_hwfn, p_ll2_conn); in qed_ll2_prepare_tx_packet()
2052 struct qed_hwfn *p_hwfn = cxt; in qed_ll2_set_fragment_of_tx_packet() local
2058 p_ll2_conn = qed_ll2_handle_sanity(p_hwfn, connection_handle); in qed_ll2_set_fragment_of_tx_packet()
2081 qed_ll2_tx_packet_notify(p_hwfn, p_ll2_conn); in qed_ll2_set_fragment_of_tx_packet()
2089 struct qed_hwfn *p_hwfn = cxt; in qed_ll2_terminate_connection() local
2094 p_ptt = qed_ptt_acquire(p_hwfn); in qed_ll2_terminate_connection()
2098 p_ll2_conn = qed_ll2_handle_sanity_lock(p_hwfn, connection_handle); in qed_ll2_terminate_connection()
2108 rc = qed_sp_ll2_tx_queue_stop(p_hwfn, p_ll2_conn); in qed_ll2_terminate_connection()
2112 qed_ll2_txq_flush(p_hwfn, connection_handle); in qed_ll2_terminate_connection()
2113 qed_int_unregister_cb(p_hwfn, p_ll2_conn->tx_queue.tx_sb_index); in qed_ll2_terminate_connection()
2121 qed_db_recovery_del(p_hwfn->cdev, in qed_ll2_terminate_connection()
2125 rc = qed_sp_ll2_rx_queue_stop(p_hwfn, p_ll2_conn); in qed_ll2_terminate_connection()
2129 qed_ll2_rxq_flush(p_hwfn, connection_handle); in qed_ll2_terminate_connection()
2130 qed_int_unregister_cb(p_hwfn, p_ll2_conn->rx_queue.rx_sb_index); in qed_ll2_terminate_connection()
2134 qed_ooo_release_all_isles(p_hwfn, p_hwfn->p_ooo_info); in qed_ll2_terminate_connection()
2137 if (!test_bit(QED_MF_UFP_SPECIFIC, &p_hwfn->cdev->mf_bits)) in qed_ll2_terminate_connection()
2138 qed_llh_remove_protocol_filter(p_hwfn->cdev, 0, in qed_ll2_terminate_connection()
2141 qed_llh_remove_protocol_filter(p_hwfn->cdev, 0, in qed_ll2_terminate_connection()
2147 qed_ptt_release(p_hwfn, p_ptt); in qed_ll2_terminate_connection()
2151 static void qed_ll2_release_connection_ooo(struct qed_hwfn *p_hwfn, in qed_ll2_release_connection_ooo() argument
2159 qed_ooo_release_all_isles(p_hwfn, p_hwfn->p_ooo_info); in qed_ll2_release_connection_ooo()
2160 while ((p_buffer = qed_ooo_get_free_buffer(p_hwfn, in qed_ll2_release_connection_ooo()
2161 p_hwfn->p_ooo_info))) { in qed_ll2_release_connection_ooo()
2162 dma_free_coherent(&p_hwfn->cdev->pdev->dev, in qed_ll2_release_connection_ooo()
2172 struct qed_hwfn *p_hwfn = cxt; in qed_ll2_release_connection() local
2175 p_ll2_conn = qed_ll2_handle_sanity(p_hwfn, connection_handle); in qed_ll2_release_connection()
2180 qed_chain_free(p_hwfn->cdev, &p_ll2_conn->tx_queue.txq_chain); in qed_ll2_release_connection()
2183 qed_chain_free(p_hwfn->cdev, &p_ll2_conn->rx_queue.rxq_chain); in qed_ll2_release_connection()
2184 qed_chain_free(p_hwfn->cdev, &p_ll2_conn->rx_queue.rcq_chain); in qed_ll2_release_connection()
2186 qed_cxt_release_cid(p_hwfn, p_ll2_conn->cid); in qed_ll2_release_connection()
2188 qed_ll2_release_connection_ooo(p_hwfn, p_ll2_conn); in qed_ll2_release_connection()
2195 int qed_ll2_alloc(struct qed_hwfn *p_hwfn) in qed_ll2_alloc() argument
2204 DP_NOTICE(p_hwfn, "Failed to allocate `struct qed_ll2'\n"); in qed_ll2_alloc()
2211 p_hwfn->p_ll2_info = p_ll2_connections; in qed_ll2_alloc()
2215 void qed_ll2_setup(struct qed_hwfn *p_hwfn) in qed_ll2_setup() argument
2220 mutex_init(&p_hwfn->p_ll2_info[i].mutex); in qed_ll2_setup()
2223 void qed_ll2_free(struct qed_hwfn *p_hwfn) in qed_ll2_free() argument
2225 if (!p_hwfn->p_ll2_info) in qed_ll2_free()
2228 kfree(p_hwfn->p_ll2_info); in qed_ll2_free()
2229 p_hwfn->p_ll2_info = NULL; in qed_ll2_free()
2232 static void _qed_ll2_get_port_stats(struct qed_hwfn *p_hwfn, in _qed_ll2_get_port_stats() argument
2239 qed_memcpy_from(p_hwfn, p_ptt, &port_stats, in _qed_ll2_get_port_stats()
2241 TSTORM_LL2_PORT_STAT_OFFSET(MFW_PORT(p_hwfn)), in _qed_ll2_get_port_stats()
2253 static void _qed_ll2_get_tstats(struct qed_hwfn *p_hwfn, in _qed_ll2_get_tstats() argument
2265 qed_memcpy_from(p_hwfn, p_ptt, &tstats, tstats_addr, sizeof(tstats)); in _qed_ll2_get_tstats()
2272 static void _qed_ll2_get_ustats(struct qed_hwfn *p_hwfn, in _qed_ll2_get_ustats() argument
2284 qed_memcpy_from(p_hwfn, p_ptt, &ustats, ustats_addr, sizeof(ustats)); in _qed_ll2_get_ustats()
2294 static void _qed_ll2_get_pstats(struct qed_hwfn *p_hwfn, in _qed_ll2_get_pstats() argument
2306 qed_memcpy_from(p_hwfn, p_ptt, &pstats, pstats_addr, sizeof(pstats)); in _qed_ll2_get_pstats()
2319 struct qed_hwfn *p_hwfn = cxt; in __qed_ll2_get_stats() local
2324 !p_hwfn->p_ll2_info) in __qed_ll2_get_stats()
2327 p_ll2_conn = &p_hwfn->p_ll2_info[connection_handle]; in __qed_ll2_get_stats()
2329 p_ptt = qed_ptt_acquire(p_hwfn); in __qed_ll2_get_stats()
2331 DP_ERR(p_hwfn, "Failed to acquire ptt\n"); in __qed_ll2_get_stats()
2336 _qed_ll2_get_port_stats(p_hwfn, p_ptt, p_stats); in __qed_ll2_get_stats()
2338 _qed_ll2_get_tstats(p_hwfn, p_ptt, p_ll2_conn, p_stats); in __qed_ll2_get_stats()
2340 _qed_ll2_get_ustats(p_hwfn, p_ptt, p_ll2_conn, p_stats); in __qed_ll2_get_stats()
2343 _qed_ll2_get_pstats(p_hwfn, p_ptt, p_ll2_conn, p_stats); in __qed_ll2_get_stats()
2345 qed_ptt_release(p_hwfn, p_ptt); in __qed_ll2_get_stats()
2363 struct qed_hwfn *p_hwfn = cxt; in qed_ll2b_release_rx_packet() local
2365 qed_ll2_dealloc_buffer(p_hwfn->cdev, cookie); in qed_ll2b_release_rx_packet()
2383 static void qed_ll2_set_conn_data(struct qed_hwfn *p_hwfn, in qed_ll2_set_conn_data() argument
2399 ll2_cbs.cookie = p_hwfn; in qed_ll2_set_conn_data()
2410 static int qed_ll2_start_ooo(struct qed_hwfn *p_hwfn, in qed_ll2_start_ooo() argument
2413 u8 *handle = &p_hwfn->pf_params.iscsi_pf_params.ll2_ooo_queue_id; in qed_ll2_start_ooo()
2417 qed_ll2_set_conn_data(p_hwfn, &data, params, in qed_ll2_start_ooo()
2420 rc = qed_ll2_acquire_connection(p_hwfn, &data); in qed_ll2_start_ooo()
2422 DP_INFO(p_hwfn, "Failed to acquire LL2 OOO connection\n"); in qed_ll2_start_ooo()
2426 rc = qed_ll2_establish_connection(p_hwfn, *handle); in qed_ll2_start_ooo()
2428 DP_INFO(p_hwfn, "Failed to establish LL2 OOO connection\n"); in qed_ll2_start_ooo()
2435 qed_ll2_release_connection(p_hwfn, *handle); in qed_ll2_start_ooo()
2449 static int __qed_ll2_stop(struct qed_hwfn *p_hwfn) in __qed_ll2_stop() argument
2451 struct qed_dev *cdev = p_hwfn->cdev; in __qed_ll2_stop()
2454 rc = qed_ll2_terminate_connection(p_hwfn, cdev->ll2->handle); in __qed_ll2_stop()
2458 qed_ll2_release_connection(p_hwfn, cdev->ll2->handle); in __qed_ll2_stop()
2466 struct qed_hwfn *p_hwfn = QED_AFFIN_HWFN(cdev); in qed_ll2_stop() local
2471 if (!QED_IS_NVMETCP_PERSONALITY(p_hwfn)) in qed_ll2_stop()
2477 if (QED_IS_ISCSI_PERSONALITY(p_hwfn) || QED_IS_NVMETCP_PERSONALITY(p_hwfn)) in qed_ll2_stop()
2478 qed_ll2_stop_ooo(p_hwfn); in qed_ll2_stop()
2488 rc = __qed_ll2_stop(p_hwfn); in qed_ll2_stop()
2490 DP_NOTICE(p_hwfn, "Failed to stop LL2\n"); in qed_ll2_stop()
2499 static int __qed_ll2_start(struct qed_hwfn *p_hwfn, in __qed_ll2_start() argument
2503 struct qed_dev *cdev = p_hwfn->cdev; in __qed_ll2_start()
2508 switch (p_hwfn->hw_info.personality) { in __qed_ll2_start()
2524 qed_ll2_set_conn_data(p_hwfn, &data, params, conn_type, in __qed_ll2_start()
2527 rc = qed_ll2_acquire_connection(p_hwfn, &data); in __qed_ll2_start()
2529 DP_INFO(p_hwfn, "Failed to acquire LL2 connection\n"); in __qed_ll2_start()
2533 rc = qed_ll2_establish_connection(p_hwfn, cdev->ll2->handle); in __qed_ll2_start()
2535 DP_INFO(p_hwfn, "Failed to establish LL2 connection\n"); in __qed_ll2_start()
2543 rc = qed_ll2_post_rx_buffer(p_hwfn, in __qed_ll2_start()
2547 DP_INFO(p_hwfn, in __qed_ll2_start()
2561 DP_NOTICE(p_hwfn, "Failed passing even a single Rx buffer\n"); in __qed_ll2_start()
2569 qed_ll2_terminate_connection(p_hwfn, cdev->ll2->handle); in __qed_ll2_start()
2571 qed_ll2_release_connection(p_hwfn, cdev->ll2->handle); in __qed_ll2_start()
2578 struct qed_hwfn *p_hwfn = QED_AFFIN_HWFN(cdev); in qed_ll2_start() local
2621 rc = __qed_ll2_start(p_hwfn, params); in qed_ll2_start()
2639 if (QED_IS_ISCSI_PERSONALITY(p_hwfn) || QED_IS_NVMETCP_PERSONALITY(p_hwfn)) { in qed_ll2_start()
2641 rc = qed_ll2_start_ooo(p_hwfn, params); in qed_ll2_start()
2648 if (!QED_IS_NVMETCP_PERSONALITY(p_hwfn)) { in qed_ll2_start()
2661 if (QED_IS_ISCSI_PERSONALITY(p_hwfn) || QED_IS_NVMETCP_PERSONALITY(p_hwfn)) in qed_ll2_start()
2662 qed_ll2_stop_ooo(p_hwfn); in qed_ll2_start()
2667 __qed_ll2_stop(p_hwfn); in qed_ll2_start()
2677 struct qed_hwfn *p_hwfn = QED_AFFIN_HWFN(cdev); in qed_ll2_start_xmit() local
2735 rc = qed_ll2_prepare_tx_packet(p_hwfn, cdev->ll2->handle, in qed_ll2_start_xmit()
2753 rc = qed_ll2_set_fragment_of_tx_packet(p_hwfn, in qed_ll2_start_xmit()
2776 struct qed_hwfn *p_hwfn = QED_AFFIN_HWFN(cdev); in qed_ll2_stats() local
2782 rc = qed_ll2_get_stats(p_hwfn, cdev->ll2->handle, stats); in qed_ll2_stats()
2784 DP_NOTICE(p_hwfn, "Failed to get LL2 stats\n"); in qed_ll2_stats()