]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Lookup up nlsock * one time in call tree
authorDonald Sharp <sharpd@nvidia.com>
Mon, 3 Jul 2023 20:49:34 +0000 (16:49 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 10 Jul 2023 13:06:40 +0000 (09:06 -0400)
Code is looking up the nlsock to generate the batch messages
and then looking it up again to get the response.  Let's
just look it up one time.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/kernel_netlink.c

index f0d44276881c4597c094ace1008cd6336c0e3b51..c98f1ce60c1e389ffcebfc805f01358d8453b130 100644 (file)
@@ -1289,18 +1289,15 @@ int netlink_request(struct nlsock *nl, void *req)
        return 0;
 }
 
-static int nl_batch_read_resp(struct nl_batch *bth)
+static int nl_batch_read_resp(struct nl_batch *bth, struct nlsock *nl)
 {
        struct nlmsghdr *h;
        struct sockaddr_nl snl;
        struct msghdr msg = {};
        int status, seq;
-       struct nlsock *nl;
        struct zebra_dplane_ctx *ctx;
        bool ignore_msg;
 
-       nl = kernel_netlink_nlsock_lookup(bth->zns->sock);
-
        msg.msg_name = (void *)&snl;
        msg.msg_namelen = sizeof(snl);
 
@@ -1493,7 +1490,7 @@ static void nl_batch_send(struct nl_batch *bth)
                        err = true;
 
                if (!err) {
-                       if (nl_batch_read_resp(bth) == -1)
+                       if (nl_batch_read_resp(bth, nl) == -1)
                                err = true;
                }
        }