Skip to content

Commit ed6e1c8

Browse files
jahay1anguy11
authored andcommitted
idpf: implement IDC vport aux driver MTU change handler
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 <[email protected]> Signed-off-by: Joshua Hay <[email protected]> Signed-off-by: Tatyana Nikolova <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent bf86a01 commit ed6e1c8

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

drivers/net/ethernet/intel/idpf/idpf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,5 +894,7 @@ int idpf_idc_init_aux_core_dev(struct idpf_adapter *adapter,
894894
void idpf_idc_deinit_core_aux_device(struct iidc_rdma_core_dev_info *cdev_info);
895895
void idpf_idc_deinit_vport_aux_device(struct iidc_rdma_vport_dev_info *vdev_info);
896896
void idpf_idc_issue_reset_event(struct iidc_rdma_core_dev_info *cdev_info);
897+
void idpf_idc_vdev_mtu_event(struct iidc_rdma_vport_dev_info *vdev_info,
898+
enum iidc_rdma_event_type event_type);
897899

898900
#endif /* !_IDPF_H_ */

drivers/net/ethernet/intel/idpf/idpf_idc.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,37 @@ static int idpf_idc_init_aux_vport_dev(struct idpf_vport *vport)
141141
return 0;
142142
}
143143

144+
/**
145+
* idpf_idc_vdev_mtu_event - Function to handle IDC vport mtu change events
146+
* @vdev_info: IDC vport device info pointer
147+
* @event_type: type of event to pass to handler
148+
*/
149+
void idpf_idc_vdev_mtu_event(struct iidc_rdma_vport_dev_info *vdev_info,
150+
enum iidc_rdma_event_type event_type)
151+
{
152+
struct iidc_rdma_vport_auxiliary_drv *iadrv;
153+
struct iidc_rdma_event event = { };
154+
struct auxiliary_device *adev;
155+
156+
if (!vdev_info)
157+
/* RDMA is not enabled */
158+
return;
159+
160+
set_bit(event_type, event.type);
161+
162+
device_lock(&vdev_info->adev->dev);
163+
adev = vdev_info->adev;
164+
if (!adev || !adev->dev.driver)
165+
goto unlock;
166+
iadrv = container_of(adev->dev.driver,
167+
struct iidc_rdma_vport_auxiliary_drv,
168+
adrv.driver);
169+
if (iadrv->event_handler)
170+
iadrv->event_handler(vdev_info, &event);
171+
unlock:
172+
device_unlock(&vdev_info->adev->dev);
173+
}
174+
144175
/**
145176
* idpf_core_adev_release - function to be mapped to aux dev's release op
146177
* @dev: pointer to device to free

drivers/net/ethernet/intel/idpf/idpf_lib.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,9 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
19251925
idpf_vport_calc_num_q_desc(new_vport);
19261926
break;
19271927
case IDPF_SR_MTU_CHANGE:
1928+
idpf_idc_vdev_mtu_event(vport->vdev_info,
1929+
IIDC_RDMA_EVENT_BEFORE_MTU_CHANGE);
1930+
break;
19281931
case IDPF_SR_RSC_CHANGE:
19291932
break;
19301933
default:
@@ -1969,9 +1972,7 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
19691972
if (current_state == __IDPF_VPORT_UP)
19701973
err = idpf_vport_open(vport);
19711974

1972-
kfree(new_vport);
1973-
1974-
return err;
1975+
goto free_vport;
19751976

19761977
err_reset:
19771978
idpf_send_add_queues_msg(vport, vport->num_txq, vport->num_complq,
@@ -1984,6 +1985,10 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
19841985
free_vport:
19851986
kfree(new_vport);
19861987

1988+
if (reset_cause == IDPF_SR_MTU_CHANGE)
1989+
idpf_idc_vdev_mtu_event(vport->vdev_info,
1990+
IIDC_RDMA_EVENT_AFTER_MTU_CHANGE);
1991+
19871992
return err;
19881993
}
19891994

0 commit comments

Comments
 (0)