[PATCH v2] nvme: consider also host_iface when checking ip options

Chao Leng lengchao at huawei.com
Mon Jul 25 19:11:41 PDT 2022



On 2022/7/25 17:25, Daniel Wagner wrote:
> On Mon, Jul 25, 2022 at 08:52:27AM +0800, Chao Leng wrote:
>>> What's wrong with it?
>> nvme over tcp has implemented host_iface-related processing.
>> But nvme over rdma(roce) do not.
>> You can test with nvme over rdma(roce).
> 
> Ah, now I get your point. Indeed this will only work for the TCP
> transport. But the RDMA transport doesn't set the NVMF_OPT_HOST_IFACE to
> the allowed_opts so we should filter out this with the additional
> NVMF_OPT_HOST_IFACE checks for the RDMA transport.
Yes, adding opts->mask filter with NVMF_OPT_HOST_IFACE is correct.
  	if (!nvmf_ctlr_matches_baseopts(ctrl, opts) ||
  	    strcmp(opts->traddr, ctrl->opts->traddr) ||
  	    strcmp(opts->trsvcid, ctrl->opts->trsvcid) ||
-	    strcmp(opts->host_iface, ctrl->opts->host_iface))
+	    (((opts->mask & NVMF_OPT_HOST_IFACE) &&
+	      (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)) &&
+	       strcmp(opts->host_iface, ctrl->opts->host_iface)))
  		return false;
Checking host_iface is similar to host_tradr, so some suggestions:
First, move these codes near checking host_traddr.
Second, the checking logic should be the same as that of host_tradr.
It might be better to add a helper to implement host port attribute
checking. Of course, this can be considered as a separate patch.
> .
> 



More information about the Linux-nvme mailing list