lib/netdev-dpdk: increase ring name length for dpdkr ports
[cascardo/ovs.git] / lib / sflow_sampler.c
index 759b5a2..7406cc9 100644 (file)
@@ -1,5 +1,9 @@
-/* Copyright (c) 2002-2009 InMon Corp. Licensed under the terms of the InMon sFlow licence: */
-/* http://www.inmon.com/technology/sflowlicense.txt */
+/* Copyright (c) 2002-2009 InMon Corp. Licensed under the terms of either the
+ *   Sun Industry Standards Source License 1.1, that is available at:
+ *    http://host-sflow.sourceforge.net/sissl.html
+ * or the InMon sFlow License, that is available at:
+ *    http://www.inmon.com/technology/sflowlicense.txt
+ */
 
 #include "sflow_api.h"
 
@@ -16,19 +20,22 @@ void sfl_sampler_init(SFLSampler *sampler, SFLAgent *agent, SFLDataSource_instan
     SFLDataSource_instance dsi = *pdsi;
 
     /* preserve the *nxt pointer too, in case we are resetting this poller and it is
-       already part of the agent's linked list (thanks to Matt Woodly for pointing this out) */
+       already part of the agent's linked list (thanks to Matt Woodly for pointing this out,
+       and to Andy Kitchingman for pointing out that it applies to the hash_nxt ptr too) */
     SFLSampler *nxtPtr = sampler->nxt;
-  
+    SFLSampler *hashPtr = sampler->hash_nxt;
+
     /* clear everything */
     memset(sampler, 0, sizeof(*sampler));
-  
-    /* restore the linked list ptr */
+
+    /* restore the linked list and hash-table ptr */
     sampler->nxt = nxtPtr;
-  
+    sampler->hash_nxt = hashPtr;
+
     /* now copy in the parameters */
     sampler->agent = agent;
     sampler->dsi = dsi;
-  
+
     /* set defaults */
     sampler->sFlowFsMaximumHeaderSize = SFL_DEFAULT_HEADER_SIZE;
     sampler->sFlowFsPacketSamplingRate = SFL_DEFAULT_SAMPLING_RATE;
@@ -154,7 +161,7 @@ inline static u_int32_t nextRandomSkip(u_int32_t mean)
 {
     if(mean == 0 || mean == 1) return 1;
     return ((random() % ((2 * mean) - 1)) + 1);
-} 
+}
 
 /*_________________---------------------------__________________
   _________________  sfl_sampler_takeSample   __________________