]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: merge lm_get_chunk_response() function
authorPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 13 Oct 2023 08:20:30 +0000 (10:20 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 13 Oct 2023 12:01:29 +0000 (14:01 +0200)
This function lm_get_chunk_response() is only called
by label_manager_get_chunk(). Let us move the code of
the function in the caller.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
zebra/label_manager.c
zebra/label_manager.h

index 0be0b4e732fa11a5d09108cc85bf1d60777a97e8..d934ae23223b5fafc938da207154cd67ca4a2ce1 100644 (file)
@@ -456,7 +456,17 @@ static int label_manager_get_chunk(struct label_manager_chunk **lmc,
 {
        *lmc = assign_label_chunk(client->proto, client->instance,
                                  client->session_id, keep, size, base);
-       return lm_get_chunk_response(*lmc, client, vrf_id);
+       /* Respond to a get_chunk request */
+       if (!*lmc)
+               flog_err(EC_ZEBRA_LM_CANNOT_ASSIGN_CHUNK,
+                        "Unable to assign Label Chunk to %s instance %u",
+                        zebra_route_string(client->proto), client->instance);
+       else if (IS_ZEBRA_DEBUG_PACKET)
+               zlog_debug("Assigned Label Chunk %u - %u to %s instance %u",
+                          (*lmc)->start, (*lmc)->end,
+                          zebra_route_string(client->proto), client->instance);
+
+       return zsend_assign_label_chunk_response(client, vrf_id, *lmc);
 }
 
 /* Respond to a connect request */
@@ -475,22 +485,6 @@ int lm_client_connect_response(uint8_t proto, uint16_t instance,
        return zsend_label_manager_connect_response(client, vrf_id, result);
 }
 
-/* Respond to a get_chunk request */
-int lm_get_chunk_response(struct label_manager_chunk *lmc, struct zserv *client,
-                         vrf_id_t vrf_id)
-{
-       if (!lmc)
-               flog_err(EC_ZEBRA_LM_CANNOT_ASSIGN_CHUNK,
-                        "Unable to assign Label Chunk to %s instance %u",
-                        zebra_route_string(client->proto), client->instance);
-       else if (IS_ZEBRA_DEBUG_PACKET)
-               zlog_debug("Assigned Label Chunk %u - %u to %s instance %u",
-                          lmc->start, lmc->end,
-                          zebra_route_string(client->proto), client->instance);
-
-       return zsend_assign_label_chunk_response(client, vrf_id, lmc);
-}
-
 void label_manager_close(void)
 {
        list_delete(&lbl_mgr.lc_list);
index cfbb4bd16987174fba29acf9292dcb937bb701b4..74f40fab23f2c84fdd917842c88b00ff6f22b698 100644 (file)
@@ -78,8 +78,6 @@ void lm_release_chunk_call(struct zserv *client, uint32_t start,
 int lm_client_connect_response(uint8_t proto, uint16_t instance,
                               uint32_t session_id, vrf_id_t vrf_id,
                               uint8_t result);
-int lm_get_chunk_response(struct label_manager_chunk *lmc, struct zserv *client,
-                         vrf_id_t vrf_id);
 
 /* convenience function to allocate an lmc to be consumed by the above API */
 struct label_manager_chunk *