]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/seastar/src/net/dpdk.cc
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / seastar / src / net / dpdk.cc
index 583fce76908fabd734d1dcbe684c0db30056662e..5f60bfb276e86eefbdd108d4aa96b60b5ff54173 100644 (file)
@@ -23,8 +23,8 @@
 #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>
@@ -397,7 +397,7 @@ public:
                 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")
@@ -493,7 +493,7 @@ public:
     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());
@@ -1028,11 +1028,11 @@ build_mbuf_cluster:
             //
             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;
@@ -1064,7 +1064,7 @@ build_mbuf_cluster:
     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
@@ -1392,7 +1392,7 @@ private:
      * @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.
@@ -1401,7 +1401,7 @@ private:
      * @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;
@@ -1415,7 +1415,7 @@ private:
     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;
@@ -1981,7 +1981,7 @@ void dpdk_qp<HugetlbfsMemBackend>::rx_start() {
 }
 
 template<>
-inline compat::optional<packet>
+inline std::optional<packet>
 dpdk_qp<false>::from_mbuf_lro(rte_mbuf* m)
 {
     //
@@ -2011,11 +2011,11 @@ 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)) {
@@ -2032,7 +2032,7 @@ dpdk_qp<false>::from_mbuf(rte_mbuf* 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);
@@ -2045,7 +2045,7 @@ dpdk_qp<false>::from_mbuf(rte_mbuf* m)
 }
 
 template<>
-inline compat::optional<packet>
+inline std::optional<packet>
 dpdk_qp<true>::from_mbuf_lro(rte_mbuf* m)
 {
     _frags.clear();
@@ -2068,7 +2068,7 @@ dpdk_qp<true>::from_mbuf_lro(rte_mbuf* m)
 }
 
 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;
@@ -2150,7 +2150,7 @@ void dpdk_qp<HugetlbfsMemBackend>::process_packets(
         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) {
@@ -2220,7 +2220,7 @@ void dpdk_device::set_rss_table()
 
     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;
@@ -2231,7 +2231,7 @@ void dpdk_device::set_rss_table()
         }
     }
 
-    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);
     }