On 9/22/25 10:22 AM, chenbox at nvidia.com (Chenbo Xia) wrote:
+static int
+pci_uio_send_fd(const struct rte_mp_msg *request, const void *peer)
+{
+       struct rte_pci_device *dev;
+       const struct pci_uio_send_fd_param *param =
+               (const struct pci_uio_send_fd_param *)request->param;
+       struct rte_mp_msg reply = {};
+       int fd;
+
+       strlcpy(reply.name, request->name, sizeof(reply.name));
+       TAILQ_FOREACH(dev, &rte_pci_bus.device_list, next) {
+               if (!rte_pci_addr_cmp(&dev->addr, &param->addr))
+                       break;
+       }
+
+       if (dev == NULL) {
+               PCI_LOG(ERR, "Could not find PCI device (" PCI_PRI_FMT ")",
+                       param->addr.domain, param->addr.bus,
+                       param->addr.devid, param->addr.function);
+               goto reply;
+       }
+
+       fd = rte_intr_fd_get(dev->intr_handle);
+       if (fd < 0) {
+               PCI_LOG(ERR, "Could not get fd (" PCI_PRI_FMT ")",
+                       param->addr.domain, param->addr.bus,
+                       param->addr.devid, param->addr.function);
+               goto reply;
+       }
Should we just return error instead of calling rte_mp_reply when dev == NULL or fd 
< 0?

We could, but that means that we won't send any response to the secondary process, so it'll timeout. I figured it's better to return a response with num_fds = 0 to let it fail immediately.

Konrad

Reply via email to