aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/mpmd/mpmd_link_if_ctrl_base.hpp
blob: fd1ef88185d8a1f5b9264083b551c92f80e6e25f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// Copyright 2017 Ettus Research, a National Instruments Company
// Copyright 2019 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//

#ifndef INCLUDED_MPMD_XPORT_CTRL_BASE_HPP
#define INCLUDED_MPMD_XPORT_CTRL_BASE_HPP

#include "mpmd_link_if_mgr.hpp"
#include <uhd/types/device_addr.hpp>
#include <uhdlib/rfnoc/chdr_packet_writer.hpp>
#include <uhdlib/transport/links.hpp>
#include <memory>

namespace uhd { namespace mpmd { namespace xport {

/*! Transport manager implementation base
 */
class mpmd_link_if_ctrl_base
{
public:
    using uptr = std::unique_ptr<mpmd_link_if_ctrl_base>;
    virtual ~mpmd_link_if_ctrl_base() {}

    virtual size_t get_num_links() const = 0;

    /*! Return links object
     *
     * \param link_idx The number of the link to use. link_idx < get_num_links()
     *                 must hold true. link_idx is often 0. Example: When
     *                 the underlying transport is Ethernet, and the user
     *                 specified both addr and second_addr, then get_num_links()
     *                 equals 2 and link_idx can also be 1.
     * \param link_type CTRL, RX_DATA, or TX_DATA (for configuring the link)
     * \param link_args Link-specific additional information that the underlying
     *                  mpmd_link_if_ctrl instantiation can use
     */
    virtual uhd::transport::both_links_t get_link(const size_t link_idx,
        const uhd::transport::link_type_t link_type,
        const uhd::device_addr_t& link_args) = 0;

    //! Return the underlying link's MTU in bytes
    virtual size_t get_mtu(const uhd::direction_t dir) const = 0;

    //! Return the rate of the underlying link in bytes/sec
    virtual double get_link_rate(const size_t link_idx) const = 0;

    //! Get the packet factory associated with this link
    virtual const uhd::rfnoc::chdr::chdr_packet_factory& get_packet_factory() const = 0;
};

}}} /* namespace uhd::mpmd::xport */

#endif /* INCLUDED_MPMD_XPORT_CTRL_BASE_HPP */