Loading drivers/nvme/host/rdma.c +14 −24 Original line number Diff line number Diff line Loading @@ -1860,25 +1860,10 @@ static inline bool __nvme_rdma_options_match(struct nvme_rdma_ctrl *ctrl, struct nvmf_ctrl_options *opts) { char *stdport = __stringify(NVME_RDMA_IP_PORT); if (!nvmf_ctlr_matches_baseopts(&ctrl->ctrl, opts) || strcmp(opts->traddr, ctrl->ctrl.opts->traddr)) return false; if (opts->mask & NVMF_OPT_TRSVCID && ctrl->ctrl.opts->mask & NVMF_OPT_TRSVCID) { if (strcmp(opts->trsvcid, ctrl->ctrl.opts->trsvcid)) return false; } else if (opts->mask & NVMF_OPT_TRSVCID) { if (strcmp(opts->trsvcid, stdport)) return false; } else if (ctrl->ctrl.opts->mask & NVMF_OPT_TRSVCID) { if (strcmp(stdport, ctrl->ctrl.opts->trsvcid)) strcmp(opts->traddr, ctrl->ctrl.opts->traddr) || strcmp(opts->trsvcid, ctrl->ctrl.opts->trsvcid)) return false; } /* else, it's a match as both have stdport. Fall to next checks */ /* * checking the local address is rough. In most cases, one Loading Loading @@ -1939,7 +1924,6 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev, struct nvme_rdma_ctrl *ctrl; int ret; bool changed; char *port; ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); if (!ctrl) Loading @@ -1947,15 +1931,21 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev, ctrl->ctrl.opts = opts; INIT_LIST_HEAD(&ctrl->list); if (opts->mask & NVMF_OPT_TRSVCID) port = opts->trsvcid; else port = __stringify(NVME_RDMA_IP_PORT); if (!(opts->mask & NVMF_OPT_TRSVCID)) { opts->trsvcid = kstrdup(__stringify(NVME_RDMA_IP_PORT), GFP_KERNEL); if (!opts->trsvcid) { ret = -ENOMEM; goto out_free_ctrl; } opts->mask |= NVMF_OPT_TRSVCID; } ret = inet_pton_with_scope(&init_net, AF_UNSPEC, opts->traddr, port, &ctrl->addr); opts->traddr, opts->trsvcid, &ctrl->addr); if (ret) { pr_err("malformed address passed: %s:%s\n", opts->traddr, port); pr_err("malformed address passed: %s:%s\n", opts->traddr, opts->trsvcid); goto out_free_ctrl; } Loading Loading
drivers/nvme/host/rdma.c +14 −24 Original line number Diff line number Diff line Loading @@ -1860,25 +1860,10 @@ static inline bool __nvme_rdma_options_match(struct nvme_rdma_ctrl *ctrl, struct nvmf_ctrl_options *opts) { char *stdport = __stringify(NVME_RDMA_IP_PORT); if (!nvmf_ctlr_matches_baseopts(&ctrl->ctrl, opts) || strcmp(opts->traddr, ctrl->ctrl.opts->traddr)) return false; if (opts->mask & NVMF_OPT_TRSVCID && ctrl->ctrl.opts->mask & NVMF_OPT_TRSVCID) { if (strcmp(opts->trsvcid, ctrl->ctrl.opts->trsvcid)) return false; } else if (opts->mask & NVMF_OPT_TRSVCID) { if (strcmp(opts->trsvcid, stdport)) return false; } else if (ctrl->ctrl.opts->mask & NVMF_OPT_TRSVCID) { if (strcmp(stdport, ctrl->ctrl.opts->trsvcid)) strcmp(opts->traddr, ctrl->ctrl.opts->traddr) || strcmp(opts->trsvcid, ctrl->ctrl.opts->trsvcid)) return false; } /* else, it's a match as both have stdport. Fall to next checks */ /* * checking the local address is rough. In most cases, one Loading Loading @@ -1939,7 +1924,6 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev, struct nvme_rdma_ctrl *ctrl; int ret; bool changed; char *port; ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); if (!ctrl) Loading @@ -1947,15 +1931,21 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev, ctrl->ctrl.opts = opts; INIT_LIST_HEAD(&ctrl->list); if (opts->mask & NVMF_OPT_TRSVCID) port = opts->trsvcid; else port = __stringify(NVME_RDMA_IP_PORT); if (!(opts->mask & NVMF_OPT_TRSVCID)) { opts->trsvcid = kstrdup(__stringify(NVME_RDMA_IP_PORT), GFP_KERNEL); if (!opts->trsvcid) { ret = -ENOMEM; goto out_free_ctrl; } opts->mask |= NVMF_OPT_TRSVCID; } ret = inet_pton_with_scope(&init_net, AF_UNSPEC, opts->traddr, port, &ctrl->addr); opts->traddr, opts->trsvcid, &ctrl->addr); if (ret) { pr_err("malformed address passed: %s:%s\n", opts->traddr, port); pr_err("malformed address passed: %s:%s\n", opts->traddr, opts->trsvcid); goto out_free_ctrl; } Loading