[PATCH v3] nvme-tcp: Print actual source IP address through sysfs "address" attr
Chaitanya Kulkarni
chaitanyak at nvidia.com
Tue Sep 6 13:12:48 PDT 2022
>
> +static int nvme_tcp_get_address(struct nvme_ctrl *ctrl, char *buf, int size)
> +{
> + int ret, len;
> + struct sockaddr_storage src_addr;
> + struct nvme_tcp_queue *queue = &to_tcp_ctrl(ctrl)->queues[0];
> +
nit:- consider this :
struct nvme_tcp_queue *queue = &to_tcp_ctrl(ctrl)->queues[0];
struct sockaddr_storage src_addr;
int ret, len;
> + len = nvmf_get_address(ctrl, buf, size);
> +
do we have add check above if len == 0 case ?
I believe you have already checked it, if not it is worth a look.
> + /* Retrieve the actual source address from the socket */
apart from the ongoing discussion, above comment is redundant
since kernel_getsockname() call is pretty clear.
> + ret = kernel_getsockname(queue->sock, (struct sockaddr *)&src_addr);
> + if (ret > 0) {
> + len--; /* strip trailing newline */
> + len += scnprintf(buf + len, size - len, "%ssrc_addr=%pISc\n",
> + (len) ? "," : "", &src_addr);
> + }
-ck
More information about the Linux-nvme
mailing list