Skip to content

Commit 26cfc69

Browse files
committed
ice: Drop auxbus use for PTP to finalize ice_adapter move
JIRA: https://issues.redhat.com/browse/RHEL-29207 Upstream commit(s): commit 0333c82 Author: Sergey Temerkhanov <[email protected]> Date: Wed Aug 21 15:09:57 2024 +0200 ice: Drop auxbus use for PTP to finalize ice_adapter move Drop unused auxbus/auxdev support from the PTP code due to move to the ice_adapter. Signed-off-by: Sergey Temerkhanov <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]> Signed-off-by: Petr Oros <[email protected]>
1 parent 9f8a7c6 commit 26cfc69

File tree

2 files changed

+0
-273
lines changed

2 files changed

+0
-273
lines changed

drivers/net/ethernet/intel/ice/ice_ptp.c

Lines changed: 0 additions & 252 deletions
Original file line numberDiff line numberDiff line change
@@ -3001,188 +3001,6 @@ static void ice_ptp_cleanup_pf(struct ice_pf *pf)
30013001
mutex_unlock(&pf->adapter->ports.lock);
30023002
}
30033003
}
3004-
/**
3005-
* ice_ptp_aux_dev_to_aux_pf - Get auxiliary PF handle for the auxiliary device
3006-
* @aux_dev: auxiliary device to get the auxiliary PF for
3007-
*/
3008-
static struct ice_pf *
3009-
ice_ptp_aux_dev_to_aux_pf(struct auxiliary_device *aux_dev)
3010-
{
3011-
struct ice_ptp_port *aux_port;
3012-
struct ice_ptp *aux_ptp;
3013-
3014-
aux_port = container_of(aux_dev, struct ice_ptp_port, aux_dev);
3015-
aux_ptp = container_of(aux_port, struct ice_ptp, port);
3016-
3017-
return container_of(aux_ptp, struct ice_pf, ptp);
3018-
}
3019-
3020-
/**
3021-
* ice_ptp_aux_dev_to_owner_pf - Get PF handle for the auxiliary device
3022-
* @aux_dev: auxiliary device to get the PF for
3023-
*/
3024-
static struct ice_pf *
3025-
ice_ptp_aux_dev_to_owner_pf(struct auxiliary_device *aux_dev)
3026-
{
3027-
struct ice_ptp_port_owner *ports_owner;
3028-
const struct auxiliary_driver *aux_drv;
3029-
struct ice_ptp *owner_ptp;
3030-
3031-
if (!aux_dev->dev.driver)
3032-
return NULL;
3033-
3034-
aux_drv = to_auxiliary_drv(aux_dev->dev.driver);
3035-
ports_owner = container_of(aux_drv, struct ice_ptp_port_owner,
3036-
aux_driver);
3037-
owner_ptp = container_of(ports_owner, struct ice_ptp, ports_owner);
3038-
return container_of(owner_ptp, struct ice_pf, ptp);
3039-
}
3040-
3041-
/**
3042-
* ice_ptp_auxbus_probe - Probe auxiliary devices
3043-
* @aux_dev: PF's auxiliary device
3044-
* @id: Auxiliary device ID
3045-
*/
3046-
static int ice_ptp_auxbus_probe(struct auxiliary_device *aux_dev,
3047-
const struct auxiliary_device_id *id)
3048-
{
3049-
struct ice_pf *owner_pf = ice_ptp_aux_dev_to_owner_pf(aux_dev);
3050-
struct ice_pf *aux_pf = ice_ptp_aux_dev_to_aux_pf(aux_dev);
3051-
3052-
if (WARN_ON(!owner_pf))
3053-
return -ENODEV;
3054-
3055-
INIT_LIST_HEAD(&aux_pf->ptp.port.list_node);
3056-
mutex_lock(&owner_pf->ptp.ports_owner.lock);
3057-
list_add(&aux_pf->ptp.port.list_node,
3058-
&owner_pf->ptp.ports_owner.ports);
3059-
mutex_unlock(&owner_pf->ptp.ports_owner.lock);
3060-
3061-
return 0;
3062-
}
3063-
3064-
/**
3065-
* ice_ptp_auxbus_remove - Remove auxiliary devices from the bus
3066-
* @aux_dev: PF's auxiliary device
3067-
*/
3068-
static void ice_ptp_auxbus_remove(struct auxiliary_device *aux_dev)
3069-
{
3070-
struct ice_pf *owner_pf = ice_ptp_aux_dev_to_owner_pf(aux_dev);
3071-
struct ice_pf *aux_pf = ice_ptp_aux_dev_to_aux_pf(aux_dev);
3072-
3073-
mutex_lock(&owner_pf->ptp.ports_owner.lock);
3074-
list_del(&aux_pf->ptp.port.list_node);
3075-
mutex_unlock(&owner_pf->ptp.ports_owner.lock);
3076-
}
3077-
3078-
/**
3079-
* ice_ptp_auxbus_shutdown
3080-
* @aux_dev: PF's auxiliary device
3081-
*/
3082-
static void ice_ptp_auxbus_shutdown(struct auxiliary_device *aux_dev)
3083-
{
3084-
/* Doing nothing here, but handle to auxbus driver must be satisfied */
3085-
}
3086-
3087-
/**
3088-
* ice_ptp_auxbus_suspend
3089-
* @aux_dev: PF's auxiliary device
3090-
* @state: power management state indicator
3091-
*/
3092-
static int
3093-
ice_ptp_auxbus_suspend(struct auxiliary_device *aux_dev, pm_message_t state)
3094-
{
3095-
/* Doing nothing here, but handle to auxbus driver must be satisfied */
3096-
return 0;
3097-
}
3098-
3099-
/**
3100-
* ice_ptp_auxbus_resume
3101-
* @aux_dev: PF's auxiliary device
3102-
*/
3103-
static int ice_ptp_auxbus_resume(struct auxiliary_device *aux_dev)
3104-
{
3105-
/* Doing nothing here, but handle to auxbus driver must be satisfied */
3106-
return 0;
3107-
}
3108-
3109-
/**
3110-
* ice_ptp_auxbus_create_id_table - Create auxiliary device ID table
3111-
* @pf: Board private structure
3112-
* @name: auxiliary bus driver name
3113-
*/
3114-
static struct auxiliary_device_id *
3115-
ice_ptp_auxbus_create_id_table(struct ice_pf *pf, const char *name)
3116-
{
3117-
struct auxiliary_device_id *ids;
3118-
3119-
/* Second id left empty to terminate the array */
3120-
ids = devm_kcalloc(ice_pf_to_dev(pf), 2,
3121-
sizeof(struct auxiliary_device_id), GFP_KERNEL);
3122-
if (!ids)
3123-
return NULL;
3124-
3125-
snprintf(ids[0].name, sizeof(ids[0].name), "ice.%s", name);
3126-
3127-
return ids;
3128-
}
3129-
3130-
/**
3131-
* ice_ptp_register_auxbus_driver - Register PTP auxiliary bus driver
3132-
* @pf: Board private structure
3133-
*/
3134-
static int __always_unused ice_ptp_register_auxbus_driver(struct ice_pf *pf)
3135-
{
3136-
struct auxiliary_driver *aux_driver;
3137-
struct ice_ptp *ptp;
3138-
struct device *dev;
3139-
char *name;
3140-
int err;
3141-
3142-
ptp = &pf->ptp;
3143-
dev = ice_pf_to_dev(pf);
3144-
aux_driver = &ptp->ports_owner.aux_driver;
3145-
INIT_LIST_HEAD(&ptp->ports_owner.ports);
3146-
mutex_init(&ptp->ports_owner.lock);
3147-
name = devm_kasprintf(dev, GFP_KERNEL, "ptp_aux_dev_%u_%u_clk%u",
3148-
pf->pdev->bus->number, PCI_SLOT(pf->pdev->devfn),
3149-
ice_get_ptp_src_clock_index(&pf->hw));
3150-
if (!name)
3151-
return -ENOMEM;
3152-
3153-
aux_driver->name = name;
3154-
aux_driver->shutdown = ice_ptp_auxbus_shutdown;
3155-
aux_driver->suspend = ice_ptp_auxbus_suspend;
3156-
aux_driver->remove = ice_ptp_auxbus_remove;
3157-
aux_driver->resume = ice_ptp_auxbus_resume;
3158-
aux_driver->probe = ice_ptp_auxbus_probe;
3159-
aux_driver->id_table = ice_ptp_auxbus_create_id_table(pf, name);
3160-
if (!aux_driver->id_table)
3161-
return -ENOMEM;
3162-
3163-
err = auxiliary_driver_register(aux_driver);
3164-
if (err) {
3165-
devm_kfree(dev, aux_driver->id_table);
3166-
dev_err(dev, "Failed registering aux_driver, name <%s>\n",
3167-
name);
3168-
}
3169-
3170-
return err;
3171-
}
3172-
3173-
/**
3174-
* ice_ptp_unregister_auxbus_driver - Unregister PTP auxiliary bus driver
3175-
* @pf: Board private structure
3176-
*/
3177-
static void __always_unused ice_ptp_unregister_auxbus_driver(struct ice_pf *pf)
3178-
{
3179-
struct auxiliary_driver *aux_driver = &pf->ptp.ports_owner.aux_driver;
3180-
3181-
auxiliary_driver_unregister(aux_driver);
3182-
devm_kfree(ice_pf_to_dev(pf), aux_driver->id_table);
3183-
3184-
mutex_destroy(&pf->ptp.ports_owner.lock);
3185-
}
31863004

31873005
/**
31883006
* ice_ptp_clock_index - Get the PTP clock index for this device
@@ -3321,76 +3139,6 @@ static int ice_ptp_init_port(struct ice_pf *pf, struct ice_ptp_port *ptp_port)
33213139
}
33223140
}
33233141

3324-
/**
3325-
* ice_ptp_release_auxbus_device
3326-
* @dev: device that utilizes the auxbus
3327-
*/
3328-
static void ice_ptp_release_auxbus_device(struct device *dev)
3329-
{
3330-
/* Doing nothing here, but handle to auxbux device must be satisfied */
3331-
}
3332-
3333-
/**
3334-
* ice_ptp_create_auxbus_device - Create PTP auxiliary bus device
3335-
* @pf: Board private structure
3336-
*/
3337-
static __always_unused int ice_ptp_create_auxbus_device(struct ice_pf *pf)
3338-
{
3339-
struct auxiliary_device *aux_dev;
3340-
struct ice_ptp *ptp;
3341-
struct device *dev;
3342-
char *name;
3343-
int err;
3344-
u32 id;
3345-
3346-
ptp = &pf->ptp;
3347-
id = ptp->port.port_num;
3348-
dev = ice_pf_to_dev(pf);
3349-
3350-
aux_dev = &ptp->port.aux_dev;
3351-
3352-
name = devm_kasprintf(dev, GFP_KERNEL, "ptp_aux_dev_%u_%u_clk%u",
3353-
pf->pdev->bus->number, PCI_SLOT(pf->pdev->devfn),
3354-
ice_get_ptp_src_clock_index(&pf->hw));
3355-
if (!name)
3356-
return -ENOMEM;
3357-
3358-
aux_dev->name = name;
3359-
aux_dev->id = id;
3360-
aux_dev->dev.release = ice_ptp_release_auxbus_device;
3361-
aux_dev->dev.parent = dev;
3362-
3363-
err = auxiliary_device_init(aux_dev);
3364-
if (err)
3365-
goto aux_err;
3366-
3367-
err = auxiliary_device_add(aux_dev);
3368-
if (err) {
3369-
auxiliary_device_uninit(aux_dev);
3370-
goto aux_err;
3371-
}
3372-
3373-
return 0;
3374-
aux_err:
3375-
dev_err(dev, "Failed to create PTP auxiliary bus device <%s>\n", name);
3376-
devm_kfree(dev, name);
3377-
return err;
3378-
}
3379-
3380-
/**
3381-
* ice_ptp_remove_auxbus_device - Remove PTP auxiliary bus device
3382-
* @pf: Board private structure
3383-
*/
3384-
static __always_unused void ice_ptp_remove_auxbus_device(struct ice_pf *pf)
3385-
{
3386-
struct auxiliary_device *aux_dev = &pf->ptp.port.aux_dev;
3387-
3388-
auxiliary_device_delete(aux_dev);
3389-
auxiliary_device_uninit(aux_dev);
3390-
3391-
memset(aux_dev, 0, sizeof(*aux_dev));
3392-
}
3393-
33943142
/**
33953143
* ice_ptp_init_tx_interrupt_mode - Initialize device Tx interrupt mode
33963144
* @pf: Board private structure

drivers/net/ethernet/intel/ice/ice_ptp.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ struct ice_ptp_tx {
140140
*
141141
* @list_node: list member structure
142142
* @tx: Tx timestamp tracking for this port
143-
* @aux_dev: auxiliary device associated with this port
144143
* @ov_work: delayed work task for tracking when PHY offset is valid
145144
* @ps_lock: mutex used to protect the overall PTP PHY start procedure
146145
* @link_up: indicates whether the link is up
@@ -150,7 +149,6 @@ struct ice_ptp_tx {
150149
struct ice_ptp_port {
151150
struct list_head list_node;
152151
struct ice_ptp_tx tx;
153-
struct auxiliary_device aux_dev;
154152
struct kthread_delayed_work ov_work;
155153
struct mutex ps_lock; /* protects overall PTP PHY start procedure */
156154
bool link_up;
@@ -164,23 +162,6 @@ enum ice_ptp_tx_interrupt {
164162
ICE_PTP_TX_INTERRUPT_ALL,
165163
};
166164

167-
/**
168-
* struct ice_ptp_port_owner - data used to handle the PTP clock owner info
169-
*
170-
* This structure contains data necessary for the PTP clock owner to correctly
171-
* handle the timestamping feature for all attached ports.
172-
*
173-
* @aux_driver: the structure carring the auxiliary driver information
174-
* @ports: list of porst handled by this port owner
175-
* @lock: protect access to ports list
176-
*/
177-
178-
struct ice_ptp_port_owner {
179-
struct auxiliary_driver aux_driver;
180-
struct list_head ports;
181-
struct mutex lock;
182-
};
183-
184165
#define GLTSYN_TGT_H_IDX_MAX 4
185166

186167
enum ice_ptp_state {
@@ -245,7 +226,6 @@ struct ice_ptp_pin_desc {
245226
* @state: current state of PTP state machine
246227
* @tx_interrupt_mode: the TX interrupt mode for the PTP clock
247228
* @port: data for the PHY port initialization procedure
248-
* @ports_owner: data for the auxiliary driver owner
249229
* @work: delayed work function for periodic tasks
250230
* @cached_phc_time: a cached copy of the PHC time for timestamp extension
251231
* @cached_phc_jiffies: jiffies when cached_phc_time was last updated
@@ -270,7 +250,6 @@ struct ice_ptp {
270250
enum ice_ptp_state state;
271251
enum ice_ptp_tx_interrupt tx_interrupt_mode;
272252
struct ice_ptp_port port;
273-
struct ice_ptp_port_owner ports_owner;
274253
struct kthread_delayed_work work;
275254
u64 cached_phc_time;
276255
unsigned long cached_phc_jiffies;

0 commit comments

Comments
 (0)