#include <cinttypes>
#include <seastar/core/posix.hh>
#include "core/vla.hh"
-#include <seastar/net/virtio-interface.hh>
#include <seastar/core/reactor.hh>
+#include <seastar/net/virtio-interface.hh>
#include <seastar/core/stream.hh>
#include <seastar/core/circular_buffer.hh>
#include <seastar/core/align.hh>
bool enable_fc)
: _port_idx(port_idx)
, _num_queues(num_queues)
- , _home_cpu(engine().cpu_id())
+ , _home_cpu(this_shard_id())
, _use_lro(use_lro)
, _enable_fc(enable_fc)
, _stats_plugin_name("network")
void set_rss_table();
virtual uint16_t hw_queues_count() override { return _num_queues; }
- virtual future<> link_ready() { return _link_ready_promise.get_future(); }
+ virtual future<> link_ready() override { return _link_ready_promise.get_future(); }
virtual std::unique_ptr<qp> init_local_queue(boost::program_options::variables_map opts, uint16_t qid) override;
virtual unsigned hash2qid(uint32_t hash) override {
assert(_redir_table.size());
//
if (_p) {
//
- // Reset the compat::optional. This in particular is going
+ // Reset the std::optional. This in particular is going
// to call the "packet"'s destructor and reset the
// "optional" state to "nonengaged".
//
- _p = compat::nullopt;
+ _p = std::nullopt;
} else if (!_is_zc) {
return;
private:
struct rte_mbuf _mbuf;
MARKER private_start;
- compat::optional<packet> _p;
+ std::optional<packet> _p;
rte_iova_t _buf_iova;
uint16_t _data_off;
// TRUE if underlying mbuf has been used in the zero-copy flow
* @return a "optional" object representing the newly received data if in an
* "engaged" state or an error if in a "disengaged" state.
*/
- compat::optional<packet> from_mbuf(rte_mbuf* m);
+ std::optional<packet> from_mbuf(rte_mbuf* m);
/**
* Transform an LRO rte_mbuf cluster into the "packet" object.
* @return a "optional" object representing the newly received LRO packet if
* in an "engaged" state or an error if in a "disengaged" state.
*/
- compat::optional<packet> from_mbuf_lro(rte_mbuf* m);
+ std::optional<packet> from_mbuf_lro(rte_mbuf* m);
private:
dpdk_device* _dev;
reactor::poller _rx_gc_poller;
std::unique_ptr<void, free_deleter> _rx_xmem;
tx_buf_factory _tx_buf_factory;
- compat::optional<reactor::poller> _rx_poller;
+ std::optional<reactor::poller> _rx_poller;
reactor::poller _tx_gc_poller;
std::vector<rte_mbuf*> _tx_burst;
uint16_t _tx_burst_idx = 0;
}
template<>
-inline compat::optional<packet>
+inline std::optional<packet>
dpdk_qp<false>::from_mbuf_lro(rte_mbuf* m)
{
//
// Drop if allocation failed
rte_pktmbuf_free(m);
- return compat::nullopt;
+ return std::nullopt;
}
template<>
-inline compat::optional<packet>
+inline std::optional<packet>
dpdk_qp<false>::from_mbuf(rte_mbuf* m)
{
if (!_dev->hw_features_ref().rx_lro || rte_pktmbuf_is_contiguous(m)) {
// Drop if allocation failed
rte_pktmbuf_free(m);
- return compat::nullopt;
+ return std::nullopt;
} else {
rte_memcpy(buf, rte_pktmbuf_mtod(m, char*), len);
rte_pktmbuf_free(m);
}
template<>
-inline compat::optional<packet>
+inline std::optional<packet>
dpdk_qp<true>::from_mbuf_lro(rte_mbuf* m)
{
_frags.clear();
}
template<>
-inline compat::optional<packet> dpdk_qp<true>::from_mbuf(rte_mbuf* m)
+inline std::optional<packet> dpdk_qp<true>::from_mbuf(rte_mbuf* m)
{
_rx_free_pkts.push_back(m);
_num_rx_free_segs += m->nb_segs;
struct rte_mbuf *m = bufs[i];
offload_info oi;
- compat::optional<packet> p = from_mbuf(m);
+ std::optional<packet> p = from_mbuf(m);
// Drop the packet if translation above has failed
if (!p) {
int reta_conf_size =
std::max(1, _dev_info.reta_size / RTE_RETA_GROUP_SIZE);
- rte_eth_rss_reta_entry64 reta_conf[reta_conf_size];
+ std::vector<rte_eth_rss_reta_entry64> reta_conf(reta_conf_size);
// Configure the HW indirection table
unsigned i = 0;
}
}
- if (rte_eth_dev_rss_reta_update(_port_idx, reta_conf, _dev_info.reta_size)) {
+ if (rte_eth_dev_rss_reta_update(_port_idx, reta_conf.data(), _dev_info.reta_size)) {
rte_exit(EXIT_FAILURE, "Port %d: Failed to update an RSS indirection table", _port_idx);
}