mpipe code cleanup: indent fixes

pull/714/head
Victor Julien 12 years ago
parent 300b739b1f
commit b61552482c

@ -662,27 +662,27 @@ static TmEcode ReceiveMpipeCreateBuckets(int ring, int num_workers,
int ceiling_log2 = 64 - __builtin_clz((int64_t)value - 1); int ceiling_log2 = 64 - __builtin_clz((int64_t)value - 1);
min_buckets = 1 << (ceiling_log2); min_buckets = 1 << (ceiling_log2);
} else { } else {
SCLogError(SC_ERR_INVALID_ARGUMENT, SCLogError(SC_ERR_INVALID_ARGUMENT,
"Illegal min-mpipe.buckets value (%ld). must be between 1 and 4096.", value); "Illegal min-mpipe.buckets value (%ld). must be between 1 and 4096.", value);
} }
} }
/* Allocate buckets. Keep trying half the number of requested buckets until min-bucket is reached. */ /* Allocate buckets. Keep trying half the number of requested buckets until min-bucket is reached. */
while (1) { while (1) {
*first_bucket = gxio_mpipe_alloc_buckets(context, *num_buckets, 0, 0); *first_bucket = gxio_mpipe_alloc_buckets(context, *num_buckets, 0, 0);
if (*first_bucket != GXIO_MPIPE_ERR_NO_BUCKET) if (*first_bucket != GXIO_MPIPE_ERR_NO_BUCKET)
break; break;
/* Failed to allocate the requested number of buckets. Keep /* Failed to allocate the requested number of buckets. Keep
* trying less buckets until min-buckets is reached. * trying less buckets until min-buckets is reached.
*/ */
if (*num_buckets <= min_buckets) { if (*num_buckets <= min_buckets) {
SCLogError(SC_ERR_INVALID_ARGUMENT, SCLogError(SC_ERR_INVALID_ARGUMENT,
"Could not allocate (%d) mpipe buckets. " "Could not allocate (%d) mpipe buckets. "
"Try a smaller mpipe.buckets value in suricata.yaml", *num_buckets); "Try a smaller mpipe.buckets value in suricata.yaml", *num_buckets);
SCReturnInt(TM_ECODE_FAILED); SCReturnInt(TM_ECODE_FAILED);
} }
/* Cut the number of requested buckets in half and try again. */ /* Cut the number of requested buckets in half and try again. */
*num_buckets /= 2; *num_buckets /= 2;
} }
/* Init group and buckets, preserving packet order among flows. */ /* Init group and buckets, preserving packet order among flows. */
@ -702,23 +702,23 @@ static TmEcode ReceiveMpipeCreateBuckets(int ring, int num_workers,
} else if (strcmp(balance, "round-robin") == 0) { } else if (strcmp(balance, "round-robin") == 0) {
mode = GXIO_MPIPE_BUCKET_ROUND_ROBIN; mode = GXIO_MPIPE_BUCKET_ROUND_ROBIN;
} else { } else {
SCLogWarning(SC_ERR_INVALID_ARGUMENT, SCLogWarning(SC_ERR_INVALID_ARGUMENT,
"Illegal load balancing mode \"%s\"", balance); "Illegal load balancing mode \"%s\"", balance);
balance = "static"; balance = "static";
} }
} }
} else { } else {
balance = "static"; balance = "static";
} }
SCLogInfo("Using \"%s\" load balancing with %d buckets.", balance, *num_buckets); SCLogInfo("Using \"%s\" load balancing with %d buckets.", balance, *num_buckets);
result = gxio_mpipe_init_notif_group_and_buckets(context, group, result = gxio_mpipe_init_notif_group_and_buckets(context, group,
ring, num_workers, ring, num_workers,
*first_bucket, *first_bucket,
*num_buckets, *num_buckets,
mode); mode);
VERIFY(result, "gxio_mpipe_init_notif_group_and_buckets()"); VERIFY(result, "gxio_mpipe_init_notif_group_and_buckets()");
SCReturnInt(TM_ECODE_OK); SCReturnInt(TM_ECODE_OK);
} }

Loading…
Cancel
Save