History

Merge tag 'nvme-6.18-2025-10-30' of git://git.infradead.org/nvme into block-6.18

Pull NVMe fixes from Keith: "- Target side authentication fixup (Hannes) - Peer-to-peer metadata fixup (Keith)" * tag 'nvme-6.18-2025-10-30' of git://git.infradead.org/nvme: nvme-pci: use blk_map_iter for p2p metadata nvmet-auth: update sc_c in host response

Jens Axboe committed 1 year ago

Commit 08d33392 parents 0b39ca4 0194b652 files · +13 −5Browse files

Unified · Split

2 files
  1. drivers/nvme/host/pci.c +10 −3
  2. drivers/nvme/target/auth.c +3 −2
drivers/nvme/host/pci.c+10−3
@@ -1042,7 +1042,7 @@ static blk_status_t nvme_map_data(struct request *req) · 1041 unmodified lines
1042 return nvme_pci_setup_data_prp(req, &iter);1042 return nvme_pci_setup_data_prp(req, &iter);
1043}1043}
1044 1044
1045static blk_status_t nvme_pci_setup_meta_sgls(struct request *req)1045static blk_status_t nvme_pci_setup_meta_iter(struct request *req)
1046{1046{
1047 struct nvme_queue *nvmeq = req->mq_hctx->driver_data;1047 struct nvme_queue *nvmeq = req->mq_hctx->driver_data;
1048 unsigned int entries = req->nr_integrity_segments;1048 unsigned int entries = req->nr_integrity_segments;
@@ -1072,8 +1072,12 @@ static blk_status_t nvme_pci_setup_meta_sgls(struct request *req) · 23 unmodified lines
1072 * descriptor provides an explicit length, so we're relying on that1072 * descriptor provides an explicit length, so we're relying on that
1073 * mechanism to catch any misunderstandings between the application and1073 * mechanism to catch any misunderstandings between the application and
1074 * device.1074 * device.
1075 *
1076 * P2P DMA also needs to use the blk_dma_iter method, so mptr setup
1077 * leverages this routine when that happens.
1075 */1078 */
1076 if (entries == 1 && !(nvme_req(req)->flags & NVME_REQ_USERCMD)) {1079 if (!nvme_ctrl_meta_sgl_supported(&dev->ctrl) ||
1080 (entries == 1 && !(nvme_req(req)->flags & NVME_REQ_USERCMD))) {
1077 iod->cmd.common.metadata = cpu_to_le64(iter.addr);1081 iod->cmd.common.metadata = cpu_to_le64(iter.addr);
1078 iod->meta_total_len = iter.len;1082 iod->meta_total_len = iter.len;
1079 iod->meta_dma = iter.addr;1083 iod->meta_dma = iter.addr;
@@ -1114,6 +1118,9 @@ static blk_status_t nvme_pci_setup_meta_mptr(struct request *req) · 34 unmodified lines
1114 struct nvme_queue *nvmeq = req->mq_hctx->driver_data;1118 struct nvme_queue *nvmeq = req->mq_hctx->driver_data;
1115 struct bio_vec bv = rq_integrity_vec(req);1119 struct bio_vec bv = rq_integrity_vec(req);
1116 1120
1121 if (is_pci_p2pdma_page(bv.bv_page))
1122 return nvme_pci_setup_meta_iter(req);
1123
1117 iod->meta_dma = dma_map_bvec(nvmeq->dev->dev, &bv, rq_dma_dir(req), 0);1124 iod->meta_dma = dma_map_bvec(nvmeq->dev->dev, &bv, rq_dma_dir(req), 0);
1118 if (dma_mapping_error(nvmeq->dev->dev, iod->meta_dma))1125 if (dma_mapping_error(nvmeq->dev->dev, iod->meta_dma))
1119 return BLK_STS_IOERR;1126 return BLK_STS_IOERR;
@@ -1128,7 +1135,7 @@ static blk_status_t nvme_map_metadata(struct request *req) · 8 unmodified lines
1128 1135
1129 if ((iod->cmd.common.flags & NVME_CMD_SGL_METABUF) &&1136 if ((iod->cmd.common.flags & NVME_CMD_SGL_METABUF) &&
1130 nvme_pci_metadata_use_sgls(req))1137 nvme_pci_metadata_use_sgls(req))
1131 return nvme_pci_setup_meta_sgls(req);1138 return nvme_pci_setup_meta_iter(req);
1132 return nvme_pci_setup_meta_mptr(req);1139 return nvme_pci_setup_meta_mptr(req);
1133}1140}
1134 1141
drivers/nvme/target/auth.c+3−2
@@ -298,7 +298,7 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response, · 297 unmodified lines
298 const char *hash_name;298 const char *hash_name;
299 u8 *challenge = req->sq->dhchap_c1;299 u8 *challenge = req->sq->dhchap_c1;
300 struct nvme_dhchap_key *transformed_key;300 struct nvme_dhchap_key *transformed_key;
301 u8 buf[4];301 u8 buf[4], sc_c = ctrl->concat ? 1 : 0;
302 int ret;302 int ret;
303 303
304 hash_name = nvme_auth_hmac_name(ctrl->shash_id);304 hash_name = nvme_auth_hmac_name(ctrl->shash_id);
@@ -367,13 +367,14 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response, · 62 unmodified lines
367 ret = crypto_shash_update(shash, buf, 2);367 ret = crypto_shash_update(shash, buf, 2);
368 if (ret)368 if (ret)
369 goto out;369 goto out;
370 memset(buf, 0, 4);370 *buf = sc_c;
371 ret = crypto_shash_update(shash, buf, 1);371 ret = crypto_shash_update(shash, buf, 1);
372 if (ret)372 if (ret)
373 goto out;373 goto out;
374 ret = crypto_shash_update(shash, "HostHost", 8);374 ret = crypto_shash_update(shash, "HostHost", 8);
375 if (ret)375 if (ret)
376 goto out;376 goto out;
377 memset(buf, 0, 4);
377 ret = crypto_shash_update(shash, ctrl->hostnqn, strlen(ctrl->hostnqn));378 ret = crypto_shash_update(shash, ctrl->hostnqn, strlen(ctrl->hostnqn));
378 if (ret)379 if (ret)
379 goto out;380 goto out;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t