]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
idpf: implement IDC vport aux driver MTU change handler
authorJoshua Hay <joshua.a.hay@intel.com>
Tue, 8 Jul 2025 21:05:53 +0000 (16:05 -0500)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 14 Jul 2025 17:57:51 +0000 (10:57 -0700)
The only event an RDMA vport aux driver cares about right now is an MTU
change on its underlying vport. Implement and plumb the handler to
signal the pre MTU change event and post MTU change events to the RDMA
vport aux driver.

Reviewed-by: Madhu Chittim <madhu.chittim@intel.com>
Signed-off-by: Joshua Hay <joshua.a.hay@intel.com>
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/idpf/idpf.h
drivers/net/ethernet/intel/idpf/idpf_idc.c
drivers/net/ethernet/intel/idpf/idpf_lib.c

index d8dee07ec838af207b87a7120254d101aff826f8..79379d6db015570bc894099085234d20be2185bd 100644 (file)
@@ -894,5 +894,7 @@ int idpf_idc_init_aux_core_dev(struct idpf_adapter *adapter,
 void idpf_idc_deinit_core_aux_device(struct iidc_rdma_core_dev_info *cdev_info);
 void idpf_idc_deinit_vport_aux_device(struct iidc_rdma_vport_dev_info *vdev_info);
 void idpf_idc_issue_reset_event(struct iidc_rdma_core_dev_info *cdev_info);
+void idpf_idc_vdev_mtu_event(struct iidc_rdma_vport_dev_info *vdev_info,
+                            enum iidc_rdma_event_type event_type);
 
 #endif /* !_IDPF_H_ */
index 530cd65e2e4408ef7c2d233a62c2255fdc350f57..2443337c83de0f471c12f48e39ea18751665fd4f 100644 (file)
@@ -141,6 +141,37 @@ static int idpf_idc_init_aux_vport_dev(struct idpf_vport *vport)
        return 0;
 }
 
+/**
+ * idpf_idc_vdev_mtu_event - Function to handle IDC vport mtu change events
+ * @vdev_info: IDC vport device info pointer
+ * @event_type: type of event to pass to handler
+ */
+void idpf_idc_vdev_mtu_event(struct iidc_rdma_vport_dev_info *vdev_info,
+                            enum iidc_rdma_event_type event_type)
+{
+       struct iidc_rdma_vport_auxiliary_drv *iadrv;
+       struct iidc_rdma_event event = { };
+       struct auxiliary_device *adev;
+
+       if (!vdev_info)
+               /* RDMA is not enabled */
+               return;
+
+       set_bit(event_type, event.type);
+
+       device_lock(&vdev_info->adev->dev);
+       adev = vdev_info->adev;
+       if (!adev || !adev->dev.driver)
+               goto unlock;
+       iadrv = container_of(adev->dev.driver,
+                            struct iidc_rdma_vport_auxiliary_drv,
+                            adrv.driver);
+       if (iadrv->event_handler)
+               iadrv->event_handler(vdev_info, &event);
+unlock:
+       device_unlock(&vdev_info->adev->dev);
+}
+
 /**
  * idpf_core_adev_release - function to be mapped to aux dev's release op
  * @dev: pointer to device to free
index 7ab156bf036e94a324d3cc4a9f11cf9cad8a8efd..00864b8c19538eb7e18fd7606f3eca8ae3aad4ba 100644 (file)
@@ -1925,6 +1925,9 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
                idpf_vport_calc_num_q_desc(new_vport);
                break;
        case IDPF_SR_MTU_CHANGE:
+               idpf_idc_vdev_mtu_event(vport->vdev_info,
+                                       IIDC_RDMA_EVENT_BEFORE_MTU_CHANGE);
+               break;
        case IDPF_SR_RSC_CHANGE:
                break;
        default:
@@ -1969,9 +1972,7 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
        if (current_state == __IDPF_VPORT_UP)
                err = idpf_vport_open(vport);
 
-       kfree(new_vport);
-
-       return err;
+       goto free_vport;
 
 err_reset:
        idpf_send_add_queues_msg(vport, vport->num_txq, vport->num_complq,
@@ -1984,6 +1985,10 @@ err_open:
 free_vport:
        kfree(new_vport);
 
+       if (reset_cause == IDPF_SR_MTU_CHANGE)
+               idpf_idc_vdev_mtu_event(vport->vdev_info,
+                                       IIDC_RDMA_EVENT_AFTER_MTU_CHANGE);
+
        return err;
 }