net/sfc: fix jumbo frame flag condition for MTU set
[dpdk.git] / lib / librte_rib / rte_rib.c
index 55d612d..6c29e1c 100644 (file)
@@ -301,7 +301,7 @@ rte_rib_insert(struct rte_rib *rib, uint32_t ip, uint8_t depth)
        /* closest node found, new_node should be inserted in the middle */
        common_depth = RTE_MIN(depth, (*tmp)->depth);
        common_prefix = ip ^ (*tmp)->ip;
-       d = __builtin_clz(common_prefix);
+       d = (common_prefix == 0) ? 32 : __builtin_clz(common_prefix);
 
        common_depth = RTE_MIN(d, common_depth);
        common_prefix = ip & rte_rib_depth_to_mask(common_depth);
@@ -342,7 +342,7 @@ rte_rib_insert(struct rte_rib *rib, uint32_t ip, uint8_t depth)
 }
 
 int
-rte_rib_get_ip(struct rte_rib_node *node, uint32_t *ip)
+rte_rib_get_ip(const struct rte_rib_node *node, uint32_t *ip)
 {
        if ((node == NULL) || (ip == NULL)) {
                rte_errno = EINVAL;
@@ -353,7 +353,7 @@ rte_rib_get_ip(struct rte_rib_node *node, uint32_t *ip)
 }
 
 int
-rte_rib_get_depth(struct rte_rib_node *node, uint8_t *depth)
+rte_rib_get_depth(const struct rte_rib_node *node, uint8_t *depth)
 {
        if ((node == NULL) || (depth == NULL)) {
                rte_errno = EINVAL;
@@ -370,7 +370,7 @@ rte_rib_get_ext(struct rte_rib_node *node)
 }
 
 int
-rte_rib_get_nh(struct rte_rib_node *node, uint64_t *nh)
+rte_rib_get_nh(const struct rte_rib_node *node, uint64_t *nh)
 {
        if ((node == NULL) || (nh == NULL)) {
                rte_errno = EINVAL;
@@ -392,7 +392,7 @@ rte_rib_set_nh(struct rte_rib_node *node, uint64_t nh)
 }
 
 struct rte_rib *
-rte_rib_create(const char *name, int socket_id, struct rte_rib_conf *conf)
+rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf)
 {
        char mem_name[RTE_RIB_NAMESIZE];
        struct rte_rib *rib = NULL;
@@ -401,8 +401,7 @@ rte_rib_create(const char *name, int socket_id, struct rte_rib_conf *conf)
        struct rte_mempool *node_pool;
 
        /* Check user arguments. */
-       if ((name == NULL) || (conf == NULL) ||
-                       (conf->max_nodes == 0)) {
+       if (name == NULL || conf == NULL || conf->max_nodes <= 0) {
                rte_errno = EINVAL;
                return NULL;
        }