]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgs/async/dpdk: fix dpdk build error
authorChunsong Feng <fengchunsong@huawei.com>
Wed, 13 Oct 2021 03:33:02 +0000 (03:33 +0000)
committerChunsong Feng <fengchunsong@huawei.com>
Thu, 14 Oct 2021 09:55:00 +0000 (09:55 +0000)
Signed-off-by: Chunsong Feng <fengchunsong@huawei.com>
src/msg/async/dpdk/DPDK.h
src/msg/async/dpdk/DPDKStack.cc
src/msg/async/dpdk/DPDKStack.h
src/msg/async/dpdk/EventDPDK.cc
src/msg/async/dpdk/EventDPDK.h
src/msg/async/dpdk/TCP.cc
src/msg/async/dpdk/TCP.h
src/msg/async/dpdk/dpdk_rte.cc

index eadba40fb49123af5b00f37b9425329598e2cea1..47c09340d63e485d25a6e55b0e0a444246eaa629 100644 (file)
@@ -44,7 +44,6 @@
 #include "net.h"
 #include "toeplitz.h"
 
-
 struct free_deleter {
   void operator()(void* p) { ::free(p); }
 };
@@ -814,7 +813,7 @@ class DPDKDevice {
     if (ret != 0) {
       rte_exit(EXIT_FAILURE, "Cannot initialise port %u\n", _port_idx);
     }
-    string name(std::string("port") + std::to_string(port_idx));
+    std::string name(std::string("port") + std::to_string(port_idx));
     PerfCountersBuilder plb(cct, name, l_dpdk_dev_first, l_dpdk_dev_last);
 
     plb.add_u64_counter(l_dpdk_dev_rx_mcast, "dpdk_device_receive_multicast_packets", "DPDK received multicast packets");
@@ -855,7 +854,8 @@ class DPDKDevice {
   }
   const rss_key_type& rss_key() const { return _rss_key; }
   uint16_t hw_queues_count() { return _num_queues; }
-  std::unique_ptr<DPDKQueuePair> init_local_queue(CephContext *c, EventCenter *center, string hugepages, uint16_t qid) {
+  std::unique_ptr<DPDKQueuePair> init_local_queue(CephContext *c,
+      EventCenter *center, std::string hugepages, uint16_t qid) {
     std::unique_ptr<DPDKQueuePair> qp;
     qp = std::unique_ptr<DPDKQueuePair>(new DPDKQueuePair(c, center, this, qid));
     return qp;
index 2bfe45e9b44c31a285f644654492070a1c666a49..a3451eec76966588d0944c819e6e1741b9acd64d 100644 (file)
@@ -142,11 +142,12 @@ void DPDKWorker::initialize()
   }
 }
 
-using AvailableIPAddress = std::tuple<string, string, string>;
+using AvailableIPAddress = std::tuple<std::string, std::string, std::string>;
 static bool parse_available_address(
-        const string &ips, const string &gates, const string &masks, vector<AvailableIPAddress> &res)
+        const std::string &ips, const std::string &gates,
+       const std::string &masks, std::vector<AvailableIPAddress> &res)
 {
-  vector<string> ip_vec, gate_vec, mask_vec;
+  std::vector<std::string> ip_vec, gate_vec, mask_vec;
   string_to_vec(ip_vec, ips);
   string_to_vec(gate_vec, gates);
   string_to_vec(mask_vec, masks);
@@ -159,7 +160,7 @@ static bool parse_available_address(
   return true;
 }
 
-static bool match_available_address(const vector<AvailableIPAddress> &avails,
+static bool match_available_address(const std::vector<AvailableIPAddress> &avails,
                                     const entity_addr_t &ip, int &res)
 {
   for (size_t i = 0; i < avails.size(); ++i) {
@@ -178,7 +179,7 @@ static bool match_available_address(const vector<AvailableIPAddress> &avails,
 DPDKWorker::Impl::Impl(CephContext *cct, unsigned i, EventCenter *c, std::shared_ptr<DPDKDevice> dev)
     : id(i), _netif(cct, dev, c), _dev(dev), _inet(cct, c, &_netif)
 {
-  vector<AvailableIPAddress> tuples;
+  std::vector<AvailableIPAddress> tuples;
   bool parsed = parse_available_address(cct->_conf.get_val<std::string>("ms_dpdk_host_ipv4_addr"),
                                         cct->_conf.get_val<std::string>("ms_dpdk_gateway_ipv4_addr"),
                                         cct->_conf.get_val<std::string>("ms_dpdk_netmask_ipv4_addr"), tuples);
@@ -263,7 +264,7 @@ void DPDKStack::spawn_worker(std::function<void ()> &&func)
       break;
     }
   }
-  void *adapted_func = static_cast<void*>(funcs.back());
+  void *adapted_func = static_cast<void*>(&funcs.back());
   dpdk::eal::execute_on_master([adapted_func, core_id, this]() {
     int r = rte_eal_remote_launch(dpdk_thread_adaptor, adapted_func, core_id);
     if (r < 0) {
index 2bd52d00245ecc28140bf3de35c6d04bf2b5c85e..acbac7b2011babdfb863231220953cb034504c12 100644 (file)
@@ -247,7 +247,7 @@ class DPDKWorker : public Worker {
 };
 
 class DPDKStack : public NetworkStack {
-  vector<std::function<void()> > funcs;
+  std::vector<std::function<void()> > funcs;
 
   virtual Worker* create_worker(CephContext *c, unsigned worker_id) override {
     return new DPDKWorker(c, worker_id);
index 5d291716c719f7d2dac047a5622084b7c73fab46..a38ddcc99b089ad70cd4f31a820c267a6e5a6e9b 100644 (file)
@@ -67,7 +67,7 @@ int DPDKDriver::resize_events(int newsize)
        return 0;
 }
 
-int DPDKDriver::event_wait(vector<FiredFileEvent> &fired_events, struct timeval *tvp)
+int DPDKDriver::event_wait(std::vector<FiredFileEvent> &fired_events, struct timeval *tvp)
 {
        int num_events = 512;
        int events[num_events];
index 541c2210e01da30b1a5d7ef1a3e5b3f6a3524378..ccf2cd28d47ac6da03d0c3800cd76efa6ac65111 100644 (file)
@@ -33,7 +33,7 @@ class DPDKDriver : public EventDriver {
   int add_event(int fd, int cur_mask, int add_mask) override;
   int del_event(int fd, int cur_mask, int del_mask) override;
   int resize_events(int newsize) override;
-  int event_wait(vector<FiredFileEvent> &fired_events, struct timeval *tp) override;
+  int event_wait(std::vector<FiredFileEvent> &fired_events, struct timeval *tp) override;
   bool need_wakeup() override { return false; }
 };
 
index 26f29e10f75ac2157202bbf98ac5efff3398819f..86c80487c46117816299c0903d53dda8f6c38f91 100644 (file)
@@ -222,7 +222,7 @@ void tcp<InetTraits>::respond_with_reset(tcp_hdr* rth, ipaddr local_ip, ipaddr f
 #undef dout_prefix
 #define dout_prefix _prefix(_dout)
 template<typename InetTraits>
-ostream& tcp<InetTraits>::tcb::_prefix(std::ostream *_dout) {
+std::ostream& tcp<InetTraits>::tcb::_prefix(std::ostream *_dout) {
   return *_dout << "tcp " << _local_ip << ":" << _local_port << " -> " << _foreign_ip << ":" << _foreign_port
                 << " tcb(" << this << " fd=" << fd << " s=" << _state << ").";
 }
index 79fd6fbb130960a61dec0a9da70ff2dbdd2cda4c..cf76d3279c03ad33e559d7845ede8a37c76ee779 100644 (file)
@@ -395,7 +395,7 @@ class tcp {
    public:
     // callback
     void close_final_cleanup();
-    ostream& _prefix(std::ostream *_dout);
+    std::ostream& _prefix(std::ostream *_dout);
 
    public:
     tcb(tcp& t, connid id);
@@ -685,7 +685,7 @@ class tcp {
     uint16_t _port;
     int _fd = -1;
     int16_t _errno;
-    queue<connection> _q;
+    std::queue<connection> _q;
     size_t _q_max_length;
 
    private:
index 0937040a00b4313eeccc01619cb2a31e2e2052f2..872d39d519de463e44d3986ba543f22b337dcefa 100644 (file)
@@ -92,7 +92,7 @@ namespace dpdk {
     t = std::thread([&]() {
       // TODO: Inherit these from the app parameters - "opts"
       std::vector<std::vector<char>> args {
-          string2vector(string("ceph")),
+          string2vector("ceph"),
           string2vector("-c"), string2vector(c->_conf.get_val<std::string>("ms_dpdk_coremask")),
           string2vector("-n"), string2vector(c->_conf->ms_dpdk_memory_channel),
       };