diff options
author | Michal Kalderon <Michal.Kalderon@cavium.com> | 2017-06-09 17:13:22 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-09 15:49:02 -0400 |
commit | 0518c12f1f79dc2f2020836974c577404e42ae89 (patch) | |
tree | a8efb6dd750ff4ae9c8791f5249924984bd2713b /include/linux/qed | |
parent | 58de289807f02122ef7eca96e50365d2c1440902 (diff) | |
download | op-kernel-dev-0518c12f1f79dc2f2020836974c577404e42ae89.zip op-kernel-dev-0518c12f1f79dc2f2020836974c577404e42ae89.tar.gz |
qed*: LL2 callback operations
LL2 today is interrupt driven - when tx/rx completion arrives [or any
other indication], qed needs to operate on the connection and pass
the information to the protocol-driver [or internal qed consumer].
Since we have several flavors of ll2 employeed by the driver,
each handler needs to do an if-else to determine the right functionality
to use based on the connection type.
In order to make things more scalable [given that we're going to add
additional types of ll2 flavors] move the infrastrucutre into using
a callback-based approach - the callbacks would be provided as part
of the connection's initialization parameters.
Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/qed')
-rw-r--r-- | include/linux/qed/qed_ll2_if.h | 36 | ||||
-rw-r--r-- | include/linux/qed/qed_roce_if.h | 80 |
2 files changed, 64 insertions, 52 deletions
diff --git a/include/linux/qed/qed_ll2_if.h b/include/linux/qed/qed_ll2_if.h index a1f63ec..5958b45e 100644 --- a/include/linux/qed/qed_ll2_if.h +++ b/include/linux/qed/qed_ll2_if.h @@ -122,6 +122,40 @@ struct qed_ll2_comp_rx_data { } u; }; +typedef +void (*qed_ll2_complete_rx_packet_cb)(void *cxt, + struct qed_ll2_comp_rx_data *data); + +typedef +void (*qed_ll2_release_rx_packet_cb)(void *cxt, + u8 connection_handle, + void *cookie, + dma_addr_t rx_buf_addr, + bool b_last_packet); + +typedef +void (*qed_ll2_complete_tx_packet_cb)(void *cxt, + u8 connection_handle, + void *cookie, + dma_addr_t first_frag_addr, + bool b_last_fragment, + bool b_last_packet); + +typedef +void (*qed_ll2_release_tx_packet_cb)(void *cxt, + u8 connection_handle, + void *cookie, + dma_addr_t first_frag_addr, + bool b_last_fragment, bool b_last_packet); + +struct qed_ll2_cbs { + qed_ll2_complete_rx_packet_cb rx_comp_cb; + qed_ll2_release_rx_packet_cb rx_release_cb; + qed_ll2_complete_tx_packet_cb tx_comp_cb; + qed_ll2_release_tx_packet_cb tx_release_cb; + void *cookie; +}; + struct qed_ll2_acquire_data_inputs { enum qed_ll2_conn_type conn_type; u16 mtu; @@ -140,6 +174,8 @@ struct qed_ll2_acquire_data_inputs { struct qed_ll2_acquire_data { struct qed_ll2_acquire_data_inputs input; + const struct qed_ll2_cbs *cbs; + /* Output container for LL2 connection's handle */ u8 *p_connection_handle; }; diff --git a/include/linux/qed/qed_roce_if.h b/include/linux/qed/qed_roce_if.h index cbb2ff0..8e70f5e 100644 --- a/include/linux/qed/qed_roce_if.h +++ b/include/linux/qed/qed_roce_if.h @@ -34,8 +34,6 @@ #include <linux/types.h> #include <linux/delay.h> #include <linux/list.h> -#include <linux/mutex.h> -#include <linux/pci.h> #include <linux/slab.h> #include <linux/qed/qed_if.h> #include <linux/qed/qed_ll2_if.h> @@ -491,42 +489,6 @@ struct qed_roce_ll2_packet { enum qed_roce_ll2_tx_dest tx_dest; }; -struct qed_roce_ll2_tx_params { - int reserved; -}; - -struct qed_roce_ll2_rx_params { - u16 vlan_id; - u8 smac[ETH_ALEN]; - int rc; -}; - -struct qed_roce_ll2_cbs { - void (*tx_cb)(void *pdev, struct qed_roce_ll2_packet *pkt); - - void (*rx_cb)(void *pdev, struct qed_roce_ll2_packet *pkt, - struct qed_roce_ll2_rx_params *params); -}; - -struct qed_roce_ll2_params { - u16 max_rx_buffers; - u16 max_tx_buffers; - u16 mtu; - u8 mac_address[ETH_ALEN]; - struct qed_roce_ll2_cbs cbs; - void *cb_cookie; -}; - -struct qed_roce_ll2_info { - u8 handle; - struct qed_roce_ll2_cbs cbs; - u8 mac_address[ETH_ALEN]; - void *cb_cookie; - - /* Lock to protect ll2 */ - struct mutex lock; -}; - enum qed_rdma_type { QED_RDMA_TYPE_ROCE, }; @@ -579,26 +541,40 @@ struct qed_rdma_ops { int (*rdma_query_qp)(void *rdma_cxt, struct qed_rdma_qp *qp, struct qed_rdma_query_qp_out_params *oparams); int (*rdma_destroy_qp)(void *rdma_cxt, struct qed_rdma_qp *qp); + int (*rdma_register_tid)(void *rdma_cxt, struct qed_rdma_register_tid_in_params *iparams); + int (*rdma_deregister_tid)(void *rdma_cxt, u32 itid); int (*rdma_alloc_tid)(void *rdma_cxt, u32 *itid); void (*rdma_free_tid)(void *rdma_cxt, u32 itid); - int (*roce_ll2_start)(struct qed_dev *cdev, - struct qed_roce_ll2_params *params); - int (*roce_ll2_stop)(struct qed_dev *cdev); - int (*roce_ll2_tx)(struct qed_dev *cdev, - struct qed_roce_ll2_packet *packet, - struct qed_roce_ll2_tx_params *params); - int (*roce_ll2_post_rx_buffer)(struct qed_dev *cdev, - struct qed_roce_ll2_buffer *buf, - u64 cookie, u8 notify_fw); - int (*roce_ll2_set_mac_filter)(struct qed_dev *cdev, - u8 *old_mac_address, - u8 *new_mac_address); - int (*roce_ll2_stats)(struct qed_dev *cdev, - struct qed_ll2_stats *stats); + + int (*ll2_acquire_connection)(void *rdma_cxt, + struct qed_ll2_acquire_data *data); + + int (*ll2_establish_connection)(void *rdma_cxt, u8 connection_handle); + int (*ll2_terminate_connection)(void *rdma_cxt, u8 connection_handle); + void (*ll2_release_connection)(void *rdma_cxt, u8 connection_handle); + + int (*ll2_prepare_tx_packet)(void *rdma_cxt, + u8 connection_handle, + struct qed_ll2_tx_pkt_info *pkt, + bool notify_fw); + + int (*ll2_set_fragment_of_tx_packet)(void *rdma_cxt, + u8 connection_handle, + dma_addr_t addr, + u16 nbytes); + int (*ll2_post_rx_buffer)(void *rdma_cxt, u8 connection_handle, + dma_addr_t addr, u16 buf_len, void *cookie, + u8 notify_fw); + int (*ll2_get_stats)(void *rdma_cxt, + u8 connection_handle, + struct qed_ll2_stats *p_stats); + int (*ll2_set_mac_filter)(struct qed_dev *cdev, + u8 *old_mac_address, u8 *new_mac_address); + }; const struct qed_rdma_ops *qed_get_rdma_ops(void); |