Commit 7b9d62ff authored by Tom Barbette's avatar Tom Barbette

Remove most warnings

Signed/unsigned comparison, initialized after, ...
parent 0f2abe84
Pipeline #1814 passed with stage
in 9 minutes and 57 seconds
...@@ -67,7 +67,7 @@ AverageBatchCounter::run_timer(Timer* t) ...@@ -67,7 +67,7 @@ AverageBatchCounter::run_timer(Timer* t)
total.count_packets += last_tick.count_packets; total.count_packets += last_tick.count_packets;
last_tick.count_batches = 0; last_tick.count_batches = 0;
last_tick.count_packets = 0; last_tick.count_packets = 0;
for (int i = 0; i < _stats.weight(); i++) { for (unsigned i = 0; i < _stats.weight(); i++) {
last_tick.count_batches += _stats.get_value(i).count_batches; last_tick.count_batches += _stats.get_value(i).count_batches;
last_tick.count_packets += _stats.get_value(i).count_packets; last_tick.count_packets += _stats.get_value(i).count_packets;
_stats.get_value(i).count_batches = 0; _stats.get_value(i).count_batches = 0;
......
...@@ -47,7 +47,6 @@ int CheckNumberPacket::configure(Vector<String> &conf, ErrorHandler *errh) { ...@@ -47,7 +47,6 @@ int CheckNumberPacket::configure(Vector<String> &conf, ErrorHandler *errh) {
} }
inline int CheckNumberPacket::smaction(Packet *p) { inline int CheckNumberPacket::smaction(Packet *p) {
WritablePacket *wp = nullptr;
if ((int)p->length() < _offset + 8) { if ((int)p->length() < _offset + 8) {
return 1; return 1;
} }
......
...@@ -75,7 +75,7 @@ FromIPSummaryDump::configure(Vector<String> &conf, ErrorHandler *errh) ...@@ -75,7 +75,7 @@ FromIPSummaryDump::configure(Vector<String> &conf, ErrorHandler *errh)
uint8_t default_proto = IP_PROTO_TCP; uint8_t default_proto = IP_PROTO_TCP;
_sampling_prob = (1 << SAMPLING_SHIFT); _sampling_prob = (1 << SAMPLING_SHIFT);
String default_contents, default_flowid, data; String default_contents, default_flowid, data;
int burst = 1; unsigned burst = 1;
if (Args(conf, this, errh) if (Args(conf, this, errh)
.read_p("FILENAME", FilenameArg(), _ff.filename()) .read_p("FILENAME", FilenameArg(), _ff.filename())
...@@ -755,12 +755,14 @@ FromIPSummaryDump::pull(int) ...@@ -755,12 +755,14 @@ FromIPSummaryDump::pull(int)
} }
#if HAVE_BATCH #if HAVE_BATCH
PacketBatch * PacketBatch *
FromIPSummaryDump::pull_batch(int,int max) FromIPSummaryDump::pull_batch(int,unsigned max)
{ {
if (!_active) if (!_active)
return 0; return 0;
PacketBatch* batch; PacketBatch* batch = 0;
MAKE_BATCH(get_packet(), batch, max); MAKE_BATCH(get_packet(), batch, max);
if (!batch)
return 0;
if (batch->count() == max) { if (batch->count() == max) {
_notifier.wake(); _notifier.wake();
} }
......
...@@ -172,9 +172,9 @@ class FromIPSummaryDump : public BatchElement, public IPSummaryDumpInfo { public ...@@ -172,9 +172,9 @@ class FromIPSummaryDump : public BatchElement, public IPSummaryDumpInfo { public
bool run_task(Task *); bool run_task(Task *);
inline Packet *get_packet(bool push=false); inline Packet *get_packet(bool push=false);
Packet *pull(int); Packet *pull(int) override;
#if HAVE_BATCH #if HAVE_BATCH
PacketBatch *pull_batch(int,int); PacketBatch *pull_batch(int,unsigned) override;
#endif #endif
void run_timer(Timer *timer); void run_timer(Timer *timer);
...@@ -216,7 +216,7 @@ class FromIPSummaryDump : public BatchElement, public IPSummaryDumpInfo { public ...@@ -216,7 +216,7 @@ class FromIPSummaryDump : public BatchElement, public IPSummaryDumpInfo { public
int _minor_version; int _minor_version;
IPFlowID _given_flowid; IPFlowID _given_flowid;
int _burst; unsigned _burst;
int read_binary(String &, ErrorHandler *); int read_binary(String &, ErrorHandler *);
......
...@@ -64,10 +64,10 @@ RecordTimestamp::smaction(Packet *p) { ...@@ -64,10 +64,10 @@ RecordTimestamp::smaction(Packet *p) {
uint64_t i; uint64_t i;
if (_offset >= 0) { if (_offset >= 0) {
i = _np ? _np->read_number_of_packet(p, _offset, _net_order) : i = _np ? _np->read_number_of_packet(p, _offset, _net_order) :
NumberPacket::read_number_of_packet(p, _offset, _net_order); NumberPacket::read_number_of_packet(p, _offset, _net_order);
assert(i < ULLONG_MAX); assert(i < ULLONG_MAX);
while (i >= _timestamps.size()) { while (i >= (unsigned)_timestamps.size()) {
if (!_dynamic && i >= _timestamps.capacity()) { if (!_dynamic && i >= (unsigned)_timestamps.capacity()) {
click_chatter("fatal error : DYNAMIC is not set and record timestamp reserved capacity is too small. Use N to augment the capacity."); click_chatter("fatal error : DYNAMIC is not set and record timestamp reserved capacity is too small. Use N to augment the capacity.");
assert(false); assert(false);
} }
......
...@@ -83,7 +83,7 @@ private: ...@@ -83,7 +83,7 @@ private:
}; };
inline Timestamp RecordTimestamp::get(uint64_t i) { inline Timestamp RecordTimestamp::get(uint64_t i) {
if (i >= _timestamps.size()) if (i >= (unsigned)_timestamps.size())
return Timestamp::uninitialized_t(); return Timestamp::uninitialized_t();
Timestamp t = _timestamps[i]; Timestamp t = _timestamps[i];
if (t == Timestamp::uninitialized_t()) if (t == Timestamp::uninitialized_t())
......
...@@ -23,8 +23,7 @@ ...@@ -23,8 +23,7 @@
#include <click/standard/scheduleinfo.hh> #include <click/standard/scheduleinfo.hh>
CLICK_DECLS CLICK_DECLS
ReplayBase::ReplayBase() : _active(true), _loaded(false), _burst(64), _stop(-1), _quick_clone(false), _task(this), _queue_head(0), _queue_current(0), _use_signal(false),_verbose(false),_freeonterminate(true), _limit(-1) ReplayBase::ReplayBase() : _active(true), _loaded(false), _burst(64), _stop(-1), _quick_clone(false), _task(this), _limit(-1), _queue_head(0), _queue_current(0), _use_signal(false),_verbose(false),_freeonterminate(true) {
{
#if HAVE_BATCH #if HAVE_BATCH
in_batch_mode = BATCH_MODE_YES; in_batch_mode = BATCH_MODE_YES;
#endif #endif
......
...@@ -35,8 +35,6 @@ GTPDecap::~GTPDecap() ...@@ -35,8 +35,6 @@ GTPDecap::~GTPDecap()
int int
GTPDecap::configure(Vector<String> &conf, ErrorHandler *errh) GTPDecap::configure(Vector<String> &conf, ErrorHandler *errh)
{ {
uint32_t eid;
if (Args(conf, this, errh) if (Args(conf, this, errh)
.complete() < 0) .complete() < 0)
return -1; return -1;
......
...@@ -81,6 +81,7 @@ GTPEncap::simple_action_batch(PacketBatch* batch) { ...@@ -81,6 +81,7 @@ GTPEncap::simple_action_batch(PacketBatch* batch) {
String GTPEncap::read_handler(Element *e, void *thunk) String GTPEncap::read_handler(Element *e, void *thunk)
{ {
GTPEncap *u = static_cast<GTPEncap *>(e); GTPEncap *u = static_cast<GTPEncap *>(e);
(void)u; //TODO
switch ((uintptr_t) thunk) { switch ((uintptr_t) thunk) {
default: default:
return String(); return String();
......
/*
* gtpfilter.{cc,hh} -- GTP Filtering element
* Tom Barbette
*
* Copyright (c) 2018 University of Liege
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, subject to the conditions
* listed in the Click LICENSE file. These conditions include: you must
* preserve this copyright notice, and you cannot mention the copyright
* holders in advertising related to the Software without their permission.
* The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
* notice is a summary of the Click LICENSE file; the license in that file is
* legally binding.
*/
#include <click/config.h>
#include <clicknet/ip.h>
#include <clicknet/udp.h>
#include <click/args.hh>
#include <click/error.hh>
#include <click/glue.hh>
#include "gtpfilter.hh"
CLICK_DECLS
GTPFilter::GTPFilter()
{
}
GTPFilter::~GTPFilter()
{
}
int
GTPFilter::configure(Vector<String> &conf, ErrorHandler *errh)
{
if (Args(conf, this, errh)
.complete() < 0)
return -1;
return 0;
}
Packet *
GTPFilter::simple_action(Packet *p_in)
{
Packet* p = p_in;
const click_ip *ip = reinterpret_cast<const click_ip *>(p->data());
const click_udp *udp = reinterpret_cast<const click_udp *>(p->data() + sizeof(click_ip));
const click_gtp *gtp = reinterpret_cast<const click_gtp *>(p->data() + sizeof(click_ip) + sizeof(click_udp));
//GTPTuple gtp_id(IP6Address(ip->ip_src), IPAddress(ip->ip_dst), ntohs(udp->uh_sport), ntohl(gtp->gtp_teid));
return p;
}
#if HAVE_BATCH
PacketBatch*
GTPFilter::simple_action_batch(PacketBatch* batch) {
EXECUTE_FOR_EACH_PACKET(GTPFilter::simple_action,batch);
return batch;
}
#endif
String GTPFilter::read_handler(Element *e, void *thunk)
{
GTPFilter *u = static_cast<GTPFilter *>(e);
switch ((uintptr_t) thunk) {
default:
return String();
}
}
void GTPFilter::add_handlers()
{
}
CLICK_ENDDECLS
EXPORT_ELEMENT(GTPFilter)
ELEMENT_MT_SAFE(GTPFilter)
#ifndef CLICK_GTPFilter_HH
#define CLICK_GTPFilter_HH
#include <click/batchelement.hh>
#include <click/glue.hh>
#include <clicknet/gtp.h>
CLICK_DECLS
/*
=c
GTPFilter(TEID eid)
=s gtp
=d
*/
class GTPFilter : public BatchElement { public:
GTPFilter() CLICK_COLD;
~GTPFilter() CLICK_COLD;
const char *class_name() const { return "GTPFilter"; }
const char *port_count() const { return PORTS_1_1; }
const char *flags() const { return "A"; }
int configure(Vector<String> &, ErrorHandler *) CLICK_COLD;
bool can_live_reconfigure() const { return true; }
void add_handlers() CLICK_COLD;
Packet *simple_action(Packet *);
#if HAVE_BATCH
PacketBatch* simple_action_batch(PacketBatch *);
#endif
private:
static String read_handler(Element *, void *) CLICK_COLD;
};
CLICK_ENDDECLS
#endif
...@@ -38,8 +38,6 @@ GTPTable::~GTPTable() ...@@ -38,8 +38,6 @@ GTPTable::~GTPTable()
int int
GTPTable::configure(Vector<String> &conf, ErrorHandler *errh) GTPTable::configure(Vector<String> &conf, ErrorHandler *errh)
{ {
uint32_t eid;
if (Args(conf, this, errh) if (Args(conf, this, errh)
.read_mp("PING_DST",_ping_dst) .read_mp("PING_DST",_ping_dst)
.complete() < 0) .complete() < 0)
...@@ -76,9 +74,8 @@ GTPTable::process(int port, Packet* p) { ...@@ -76,9 +74,8 @@ GTPTable::process(int port, Packet* p) {
uint32_t gen = click_random(); uint32_t gen = click_random();
uint16_t icmp_id = gen + 3; uint16_t icmp_id = gen + 3;
uint16_t icmp_seq = gen >> 16 + 3; uint16_t icmp_seq = (gen >> 16) + 3;
//size_t hsz = sizeof(click_ip) + sizeof(click_icmp_echo);
size_t data_size = 60; size_t data_size = 60;
WritablePacket* q = Packet::make(sz + data_size); WritablePacket* q = Packet::make(sz + data_size);
if (q) { if (q) {
...@@ -152,6 +149,8 @@ GTPTable::process(int port, Packet* p) { ...@@ -152,6 +149,8 @@ GTPTable::process(int port, Packet* p) {
} }
(void)known; //TODO
//Pull packet to inner header //Pull packet to inner header
p->pull(sz); p->pull(sz);
......
...@@ -397,6 +397,8 @@ String QueueDevice::count_handler(Element *e, void *user_data) ...@@ -397,6 +397,8 @@ String QueueDevice::count_handler(Element *e, void *user_data)
switch (what) { switch (what) {
case h_count: case h_count:
return String(tdd->n_count()); return String(tdd->n_count());
default:
return "<undefined>";
} }
} }
......
...@@ -199,7 +199,7 @@ private: ...@@ -199,7 +199,7 @@ private:
template <typename T, bool ZERO, int POOL_SIZE, int POOL_COUNT> template <typename T, bool ZERO, int POOL_SIZE, int POOL_COUNT>
pool_allocator_mt<T,ZERO,POOL_SIZE,POOL_COUNT>::pool_allocator_mt() :_global_count(0),_global_pool(0),_pool(Pool()) { pool_allocator_mt<T,ZERO,POOL_SIZE,POOL_COUNT>::pool_allocator_mt() : _pool(Pool()), _global_count(0),_global_pool(0) {
#if CLICK_DEBUG_ALLOCATOR #if CLICK_DEBUG_ALLOCATOR
_released = 0; _released = 0;
_allocated = 0; _allocated = 0;
...@@ -222,7 +222,7 @@ pool_allocator_mt<T,ZERO,POOL_SIZE,POOL_COUNT>::~pool_allocator_mt() { ...@@ -222,7 +222,7 @@ pool_allocator_mt<T,ZERO,POOL_SIZE,POOL_COUNT>::~pool_allocator_mt() {
n_release++; n_release++;
} }
} }
for (int i = 0 ; i < _pool.weight(); i++) { for (unsigned i = 0 ; i < _pool.weight(); i++) {
Pool &pool = _pool.get_value(i); Pool &pool = _pool.get_value(i);
item* p = pool.first; item* p = pool.first;
item* next; item* next;
......
...@@ -361,7 +361,7 @@ class HashContainerMP { public: ...@@ -361,7 +361,7 @@ class HashContainerMP { public:
void release_pending(bool force=false) { void release_pending(bool force=false) {
ListItem* it; ListItem* it;
ListItem* next; ListItem* next;
for (int i = 0; i < _pending_release.weight() ; i++) { for (unsigned i = 0; i < _pending_release.weight() ; i++) {
it = _pending_release.get_value(i); it = _pending_release.get_value(i);
while (it) { while (it) {
next = it->_hashnext; next = it->_hashnext;
...@@ -396,14 +396,14 @@ void HashContainerMP<K,V,Item>::deinitialize() ...@@ -396,14 +396,14 @@ void HashContainerMP<K,V,Item>::deinitialize()
template <typename K, typename V, typename Item> template <typename K, typename V, typename Item>
HashContainerMP<K,V,Item>::HashContainerMP() : HashContainerMP<K,V,Item>::HashContainerMP() :
_table(), _pending_release(0), _mt(true) _mt(true), _table(), _pending_release(0)
{ {
initialize(initial_bucket_count); initialize(initial_bucket_count);
} }
template <typename K, typename V, typename Item> template <typename K, typename V, typename Item>
HashContainerMP<K,V,Item>::HashContainerMP(size_type nb) : HashContainerMP<K,V,Item>::HashContainerMP(size_type nb) :
_table(), _pending_release(0) _mt(true), _table(), _pending_release(0)
{ {
size_type b = 1; size_type b = 1;
while (b < nb && b < max_bucket_count) while (b < nb && b < max_bucket_count)
...@@ -517,7 +517,6 @@ retry:\ ...@@ -517,7 +517,6 @@ retry:\
goto retry;\ goto retry;\
}\ }\
ListItem* e = allocate(ListItem(key,value));\ ListItem* e = allocate(ListItem(key,value));\
V* v = e->item.unprotected_ptr();\
click_hashmp_assert(e->item.refcnt() == 0);\ click_hashmp_assert(e->item.refcnt() == 0);\
e->_hashnext = bucket.list->head;\ e->_hashnext = bucket.list->head;\
\ \
......
...@@ -1080,10 +1080,10 @@ protected: ...@@ -1080,10 +1080,10 @@ protected:
template <typename T> template <typename T>
class fast_rcu { public: class fast_rcu { public:
#define N 2 #define N 2
fast_rcu() : _rcu_current(0), _write_epoch(1), _epochs(0) { fast_rcu() : _rcu_current(0), _epochs(0), _write_epoch(1) {
} }
fast_rcu(T v) : _rcu_current(0), _write_epoch(1), _epochs(0) { fast_rcu(T v) : _rcu_current(0), _epochs(0), _write_epoch(1){
initialize(v); initialize(v);
} }
...@@ -1123,7 +1123,7 @@ class fast_rcu { public: ...@@ -1123,7 +1123,7 @@ class fast_rcu { public:
int rcu_next = (rcu_current_local + 1) & 1; int rcu_next = (rcu_current_local + 1) & 1;
int bad_epoch = (_write_epoch - N) + 1; int bad_epoch = (_write_epoch - N) + 1;
int i = 0; unsigned i = 0;
loop: loop:
for (; i < _epochs.weight(); i ++) { for (; i < _epochs.weight(); i ++) {
int te = _epochs.get_value(i); int te = _epochs.get_value(i);
......
...@@ -230,7 +230,7 @@ CLICK_DECLS ...@@ -230,7 +230,7 @@ CLICK_DECLS
Packet* last = head;\ Packet* last = head;\
if (head != NULL) {\ if (head != NULL) {\
unsigned int count = 1;\ unsigned int count = 1;\
while (count < (max>0?max:BATCH_MAX_PULL)) {\ while (count < (unsigned)(max>0?max:BATCH_MAX_PULL)) {\
Packet* current = fnt;\ Packet* current = fnt;\
if (current == NULL)\ if (current == NULL)\
break;\ break;\
......
...@@ -427,10 +427,11 @@ Element::Element() ...@@ -427,10 +427,11 @@ Element::Element()
in_batch_mode(BATCH_MODE_NO), in_batch_mode(BATCH_MODE_NO),
#endif #endif
receives_batch(false), receives_batch(false),
_router(0), _eindex(-1)
#if HAVE_FULLPUSH_NONATOMIC #if HAVE_FULLPUSH_NONATOMIC
_is_fullpush(false), ,_is_fullpush(false)
#endif #endif
_router(0), _eindex(-1)
{ {
nelements_allocated++; nelements_allocated++;
_ports[0] = _ports[1] = &_inline_ports[0]; _ports[0] = _ports[1] = &_inline_ports[0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment