diff options
Diffstat (limited to 'host/lib/include/uhdlib/rfnoc')
| -rw-r--r-- | host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp | 26 | ||||
| -rw-r--r-- | host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp | 16 | ||||
| -rw-r--r-- | host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp | 12 | 
3 files changed, 39 insertions, 15 deletions
| diff --git a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp index 38acd7a34..7d5613f5d 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp @@ -19,12 +19,13 @@ namespace uhd { namespace rfnoc {  class chdr_ctrl_xport  {  public: -    using io_service   = uhd::transport::io_service; -    using frame_buff   = uhd::transport::frame_buff; -    using send_link_if = uhd::transport::send_link_if; -    using recv_link_if = uhd::transport::recv_link_if; -    using send_io_if   = uhd::transport::send_io_if; -    using recv_io_if   = uhd::transport::recv_io_if; +    using io_service            = uhd::transport::io_service; +    using frame_buff            = uhd::transport::frame_buff; +    using send_link_if          = uhd::transport::send_link_if; +    using recv_link_if          = uhd::transport::recv_link_if; +    using send_io_if            = uhd::transport::send_io_if; +    using recv_io_if            = uhd::transport::recv_io_if; +    using disconnect_callback_t = uhd::transport::disconnect_callback_t;      using sptr = std::shared_ptr<chdr_ctrl_xport>; @@ -37,6 +38,7 @@ public:       * \param my_epid The local EPID for this transport       * \param num_send_frames Number of frames to reserve for TX       * \param num_recv_frames Number of frames to reserve for RX +     * \param disconnect Callback function to disconnect the links       */      static sptr make(io_service::sptr io_srv,          send_link_if::sptr send_link, @@ -44,7 +46,8 @@ public:          const chdr::chdr_packet_factory& pkt_factory,          sep_id_t my_epid,          size_t num_send_frames, -        size_t num_recv_frames) +        size_t num_recv_frames, +        disconnect_callback_t disconnect)      {          return std::make_shared<chdr_ctrl_xport>(io_srv,              send_link, @@ -52,7 +55,8 @@ public:              pkt_factory,              my_epid,              num_send_frames, -            num_recv_frames); +            num_recv_frames, +            disconnect);      }      /*! @@ -64,6 +68,7 @@ public:       * \param my_epid The local EPID for this transport       * \param num_send_frames Number of frames to reserve for TX       * \param num_recv_frames Number of frames to reserve for RX +     * \param disconnect Callback function to disconnect the links       */      chdr_ctrl_xport(io_service::sptr io_srv,          send_link_if::sptr send_link, @@ -71,7 +76,8 @@ public:          const chdr::chdr_packet_factory& pkt_factory,          sep_id_t my_epid,          size_t num_send_frames, -        size_t num_recv_frames); +        size_t num_recv_frames, +        disconnect_callback_t disconnect);      ~chdr_ctrl_xport(); @@ -151,6 +157,8 @@ private:      recv_io_if::sptr _ctrl_recv_if;      recv_io_if::sptr _mgmt_recv_if; +    // Disconnect callback +    disconnect_callback_t _disconnect;      // FIXME: Remove this when have threaded_io_service      std::mutex _mutex; diff --git a/host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp b/host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp index d6a2e6628..cb0987446 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp @@ -100,8 +100,9 @@ private:  class chdr_rx_data_xport  {  public: -    using uptr   = std::unique_ptr<chdr_rx_data_xport>; -    using buff_t = transport::frame_buff; +    using uptr                  = std::unique_ptr<chdr_rx_data_xport>; +    using buff_t                = transport::frame_buff; +    using disconnect_callback_t = uhd::transport::disconnect_callback_t;      //! Values extracted from received RX data packets      struct packet_info_t @@ -135,6 +136,7 @@ public:       * \param fc_freq Frequency of flow control status messages       * \param fc_headroom Headroom for flow control status messages       * \param lossy_xport Whether the xport is lossy, for flow control configuration +     * \param disconnect Callback function to disconnect the links       * \return Parameters for xport flow control       */      static fc_params_t configure_sep(uhd::transport::io_service::sptr io_srv, @@ -148,7 +150,8 @@ public:          const stream_buff_params_t& recv_capacity,          const stream_buff_params_t& fc_freq,          const stream_buff_params_t& fc_headroom, -        const bool lossy_xport); +        const bool lossy_xport, +        disconnect_callback_t disconnect);      /*! Constructor       * @@ -159,6 +162,7 @@ public:       * \param epids Source and destination endpoint IDs       * \param num_recv_frames Num frames to reserve from the recv link       * \param fc_params Parameters for flow control +     * \param disconnect Callback function to disconnect the links       */      chdr_rx_data_xport(uhd::transport::io_service::sptr io_srv,          uhd::transport::recv_link_if::sptr recv_link, @@ -166,7 +170,8 @@ public:          const chdr::chdr_packet_factory& pkt_factory,          const uhd::rfnoc::sep_id_pair_t& epids,          const size_t num_recv_frames, -        const fc_params_t& fc_params); +        const fc_params_t& fc_params, +        disconnect_callback_t disconnect);      /*! Destructor       */ @@ -404,6 +409,9 @@ private:      //! The CHDR width in bytes.      size_t _chdr_w_bytes; + +    // Disconnect callback +    disconnect_callback_t _disconnect;  };  }} // namespace uhd::rfnoc diff --git a/host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp b/host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp index ed008c1db..4e8ebe24d 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp @@ -106,6 +106,7 @@ public:      using buff_t = transport::frame_buff;      using enqueue_async_msg_fn_t =          std::function<void(async_metadata_t::event_code_t, bool, uint64_t)>; +    using disconnect_callback_t = uhd::transport::disconnect_callback_t;      //! Information about data packet      struct packet_info_t @@ -135,6 +136,7 @@ public:       * \param mdata_buff_fmt Datatype of SW buffer that holds the data metadata       * \param fc_freq_ratio Ratio to use to configure the device fc frequency       * \param fc_headroom_ratio Ratio to use to configure the device fc headroom +     * \param disconnect Callback function to disconnect the links       * \return Parameters for xport flow control       */      static fc_params_t configure_sep(uhd::transport::io_service::sptr io_srv, @@ -146,7 +148,8 @@ public:          const uhd::rfnoc::sw_buff_t pyld_buff_fmt,          const uhd::rfnoc::sw_buff_t mdata_buff_fmt,          const double fc_freq_ratio, -        const double fc_headroom_ratio); +        const double fc_headroom_ratio, +        disconnect_callback_t disconnect);      /*! Constructor       * @@ -157,6 +160,7 @@ public:       * \param epids Source and destination endpoint IDs       * \param num_send_frames Num frames to reserve from the send link       * \param fc_params Parameters for flow control +     * \param disconnect Callback function to disconnect the links       */      chdr_tx_data_xport(uhd::transport::io_service::sptr io_srv,          uhd::transport::recv_link_if::sptr recv_link, @@ -164,7 +168,8 @@ public:          const chdr::chdr_packet_factory& pkt_factory,          const uhd::rfnoc::sep_id_pair_t& epids,          const size_t num_send_frames, -        const fc_params_t fc_params); +        const fc_params_t fc_params, +        disconnect_callback_t disconnect);      /*! Destructor       */ @@ -397,6 +402,9 @@ private:      //! The size of the send frame      size_t _frame_size; + +    // Disconnect callback +    disconnect_callback_t _disconnect;  };  }} // namespace uhd::rfnoc | 
