Skip to content

Commit

Permalink
zebra: Lookup up nlsock * one time in call tree
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
donaldsharp committed Jul 7, 2023
1 parent 22eeaf0 commit f9f5ce8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions zebra/kernel_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit f9f5ce8

Please sign in to comment.