Skip to content

Commit bcbedf2

Browse files
atbrady-intelanguy11
authored andcommitted
idpf: cleanup virtchnl cruft
We can now remove a bunch of gross code we don't need anymore like the vc state bits and vc_buf_lock since everything is using transaction API now. Tested-by: Alexander Lobakin <aleksander.lobakin@intel.com> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Reviewed-by: Igor Bagnucki <igor.bagnucki@intel.com> Signed-off-by: Alan Brady <alan.brady@intel.com> Tested-by: Krishneil Singh <krishneil.k.singh@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent e54232d commit bcbedf2

File tree

4 files changed

+3
-125
lines changed

4 files changed

+3
-125
lines changed

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

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ struct idpf_vport_max_q;
3737
#define IDPF_MB_MAX_ERR 20
3838
#define IDPF_NUM_CHUNKS_PER_MSG(struct_sz, chunk_sz) \
3939
((IDPF_CTLQ_MAX_BUF_LEN - (struct_sz)) / (chunk_sz))
40-
#define IDPF_WAIT_FOR_EVENT_TIMEO_MIN 2000
41-
#define IDPF_WAIT_FOR_EVENT_TIMEO 60000
4240

4341
#define IDPF_MAX_WAIT 500
4442

@@ -207,71 +205,6 @@ struct idpf_dev_ops {
207205
struct idpf_reg_ops reg_ops;
208206
};
209207

210-
/* These macros allow us to generate an enum and a matching char * array of
211-
* stringified enums that are always in sync. Checkpatch issues a bogus warning
212-
* about this being a complex macro; but it's wrong, these are never used as a
213-
* statement and instead only used to define the enum and array.
214-
*/
215-
#define IDPF_FOREACH_VPORT_VC_STATE(STATE) \
216-
STATE(IDPF_VC_CREATE_VPORT) \
217-
STATE(IDPF_VC_CREATE_VPORT_ERR) \
218-
STATE(IDPF_VC_ENA_VPORT) \
219-
STATE(IDPF_VC_ENA_VPORT_ERR) \
220-
STATE(IDPF_VC_DIS_VPORT) \
221-
STATE(IDPF_VC_DIS_VPORT_ERR) \
222-
STATE(IDPF_VC_DESTROY_VPORT) \
223-
STATE(IDPF_VC_DESTROY_VPORT_ERR) \
224-
STATE(IDPF_VC_CONFIG_TXQ) \
225-
STATE(IDPF_VC_CONFIG_TXQ_ERR) \
226-
STATE(IDPF_VC_CONFIG_RXQ) \
227-
STATE(IDPF_VC_CONFIG_RXQ_ERR) \
228-
STATE(IDPF_VC_ENA_QUEUES) \
229-
STATE(IDPF_VC_ENA_QUEUES_ERR) \
230-
STATE(IDPF_VC_DIS_QUEUES) \
231-
STATE(IDPF_VC_DIS_QUEUES_ERR) \
232-
STATE(IDPF_VC_MAP_IRQ) \
233-
STATE(IDPF_VC_MAP_IRQ_ERR) \
234-
STATE(IDPF_VC_UNMAP_IRQ) \
235-
STATE(IDPF_VC_UNMAP_IRQ_ERR) \
236-
STATE(IDPF_VC_ADD_QUEUES) \
237-
STATE(IDPF_VC_ADD_QUEUES_ERR) \
238-
STATE(IDPF_VC_DEL_QUEUES) \
239-
STATE(IDPF_VC_DEL_QUEUES_ERR) \
240-
STATE(IDPF_VC_ALLOC_VECTORS) \
241-
STATE(IDPF_VC_ALLOC_VECTORS_ERR) \
242-
STATE(IDPF_VC_DEALLOC_VECTORS) \
243-
STATE(IDPF_VC_DEALLOC_VECTORS_ERR) \
244-
STATE(IDPF_VC_SET_SRIOV_VFS) \
245-
STATE(IDPF_VC_SET_SRIOV_VFS_ERR) \
246-
STATE(IDPF_VC_GET_RSS_LUT) \
247-
STATE(IDPF_VC_GET_RSS_LUT_ERR) \
248-
STATE(IDPF_VC_SET_RSS_LUT) \
249-
STATE(IDPF_VC_SET_RSS_LUT_ERR) \
250-
STATE(IDPF_VC_GET_RSS_KEY) \
251-
STATE(IDPF_VC_GET_RSS_KEY_ERR) \
252-
STATE(IDPF_VC_SET_RSS_KEY) \
253-
STATE(IDPF_VC_SET_RSS_KEY_ERR) \
254-
STATE(IDPF_VC_GET_STATS) \
255-
STATE(IDPF_VC_GET_STATS_ERR) \
256-
STATE(IDPF_VC_ADD_MAC_ADDR) \
257-
STATE(IDPF_VC_ADD_MAC_ADDR_ERR) \
258-
STATE(IDPF_VC_DEL_MAC_ADDR) \
259-
STATE(IDPF_VC_DEL_MAC_ADDR_ERR) \
260-
STATE(IDPF_VC_GET_PTYPE_INFO) \
261-
STATE(IDPF_VC_GET_PTYPE_INFO_ERR) \
262-
STATE(IDPF_VC_LOOPBACK_STATE) \
263-
STATE(IDPF_VC_LOOPBACK_STATE_ERR) \
264-
STATE(IDPF_VC_NBITS)
265-
266-
#define IDPF_GEN_ENUM(ENUM) ENUM,
267-
#define IDPF_GEN_STRING(STRING) #STRING,
268-
269-
enum idpf_vport_vc_state {
270-
IDPF_FOREACH_VPORT_VC_STATE(IDPF_GEN_ENUM)
271-
};
272-
273-
extern const char * const idpf_vport_vc_state_str[];
274-
275208
/**
276209
* enum idpf_vport_reset_cause - Vport soft reset causes
277210
* @IDPF_SR_Q_CHANGE: Soft reset queue change
@@ -356,11 +289,7 @@ struct idpf_port_stats {
356289
* @port_stats: per port csum, header split, and other offload stats
357290
* @link_up: True if link is up
358291
* @link_speed_mbps: Link speed in mbps
359-
* @vc_msg: Virtchnl message buffer
360-
* @vc_state: Virtchnl message state
361-
* @vchnl_wq: Wait queue for virtchnl messages
362292
* @sw_marker_wq: workqueue for marker packets
363-
* @vc_buf_lock: Lock to protect virtchnl buffer
364293
*/
365294
struct idpf_vport {
366295
u16 num_txq;
@@ -406,12 +335,7 @@ struct idpf_vport {
406335
bool link_up;
407336
u32 link_speed_mbps;
408337

409-
char vc_msg[IDPF_CTLQ_MAX_BUF_LEN];
410-
DECLARE_BITMAP(vc_state, IDPF_VC_NBITS);
411-
412-
wait_queue_head_t vchnl_wq;
413338
wait_queue_head_t sw_marker_wq;
414-
struct mutex vc_buf_lock;
415339
};
416340

417341
/**
@@ -474,15 +398,11 @@ struct idpf_vport_user_config_data {
474398
* enum idpf_vport_config_flags - Vport config flags
475399
* @IDPF_VPORT_REG_NETDEV: Register netdev
476400
* @IDPF_VPORT_UP_REQUESTED: Set if interface up is requested on core reset
477-
* @IDPF_VPORT_ADD_MAC_REQ: Asynchronous add ether address in flight
478-
* @IDPF_VPORT_DEL_MAC_REQ: Asynchronous delete ether address in flight
479401
* @IDPF_VPORT_CONFIG_FLAGS_NBITS: Must be last
480402
*/
481403
enum idpf_vport_config_flags {
482404
IDPF_VPORT_REG_NETDEV,
483405
IDPF_VPORT_UP_REQUESTED,
484-
IDPF_VPORT_ADD_MAC_REQ,
485-
IDPF_VPORT_DEL_MAC_REQ,
486406
IDPF_VPORT_CONFIG_FLAGS_NBITS,
487407
};
488408

@@ -601,9 +521,6 @@ struct idpf_vc_xn_manager;
601521
* @stats_task: Periodic statistics retrieval task
602522
* @stats_wq: Workqueue for statistics task
603523
* @caps: Negotiated capabilities with device
604-
* @vchnl_wq: Wait queue for virtchnl messages
605-
* @vc_state: Virtchnl message state
606-
* @vc_msg: Virtchnl message buffer
607524
* @vcxn_mngr: Virtchnl transaction manager
608525
* @dev_ops: See idpf_dev_ops
609526
* @num_vfs: Number of allocated VFs through sysfs. PF does not directly talk
@@ -660,11 +577,8 @@ struct idpf_adapter {
660577
struct delayed_work stats_task;
661578
struct workqueue_struct *stats_wq;
662579
struct virtchnl2_get_capabilities caps;
663-
664-
wait_queue_head_t vchnl_wq;
665-
DECLARE_BITMAP(vc_state, IDPF_VC_NBITS);
666-
char vc_msg[IDPF_CTLQ_MAX_BUF_LEN];
667580
struct idpf_vc_xn_manager *vcxn_mngr;
581+
668582
struct idpf_dev_ops dev_ops;
669583
int num_vfs;
670584
bool crc_enable;

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

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
static const struct net_device_ops idpf_netdev_ops_splitq;
88
static const struct net_device_ops idpf_netdev_ops_singleq;
99

10-
const char * const idpf_vport_vc_state_str[] = {
11-
IDPF_FOREACH_VPORT_VC_STATE(IDPF_GEN_STRING)
12-
};
13-
1410
/**
1511
* idpf_init_vector_stack - Fill the MSIX vector stack with vector index
1612
* @adapter: private data struct
@@ -976,7 +972,6 @@ static void idpf_vport_rel(struct idpf_vport *vport)
976972
struct idpf_rss_data *rss_data;
977973
struct idpf_vport_max_q max_q;
978974
u16 idx = vport->idx;
979-
int i;
980975

981976
vport_config = adapter->vport_config[vport->idx];
982977
idpf_deinit_rss(vport);
@@ -986,20 +981,6 @@ static void idpf_vport_rel(struct idpf_vport *vport)
986981

987982
idpf_send_destroy_vport_msg(vport);
988983

989-
/* Set all bits as we dont know on which vc_state the vport vhnl_wq
990-
* is waiting on and wakeup the virtchnl workqueue even if it is
991-
* waiting for the response as we are going down
992-
*/
993-
for (i = 0; i < IDPF_VC_NBITS; i++)
994-
set_bit(i, vport->vc_state);
995-
wake_up(&vport->vchnl_wq);
996-
997-
mutex_destroy(&vport->vc_buf_lock);
998-
999-
/* Clear all the bits */
1000-
for (i = 0; i < IDPF_VC_NBITS; i++)
1001-
clear_bit(i, vport->vc_state);
1002-
1003984
/* Release all max queues allocated to the adapter's pool */
1004985
max_q.max_rxq = vport_config->max_q.max_rxq;
1005986
max_q.max_txq = vport_config->max_q.max_txq;
@@ -1544,9 +1525,7 @@ void idpf_init_task(struct work_struct *work)
15441525
vport_config = adapter->vport_config[index];
15451526

15461527
init_waitqueue_head(&vport->sw_marker_wq);
1547-
init_waitqueue_head(&vport->vchnl_wq);
15481528

1549-
mutex_init(&vport->vc_buf_lock);
15501529
spin_lock_init(&vport_config->mac_filter_list_lock);
15511530

15521531
INIT_LIST_HEAD(&vport_config->user_config.mac_filter_list);
@@ -1905,7 +1884,7 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
19051884
* mess with. Nothing below should use those variables from new_vport
19061885
* and should instead always refer to them in vport if they need to.
19071886
*/
1908-
memcpy(new_vport, vport, offsetof(struct idpf_vport, vc_state));
1887+
memcpy(new_vport, vport, offsetof(struct idpf_vport, link_speed_mbps));
19091888

19101889
/* Adjust resource parameters prior to reallocating resources */
19111890
switch (reset_cause) {
@@ -1954,7 +1933,7 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
19541933
/* Same comment as above regarding avoiding copying the wait_queues and
19551934
* mutexes applies here. We do not want to mess with those if possible.
19561935
*/
1957-
memcpy(vport, new_vport, offsetof(struct idpf_vport, vc_state));
1936+
memcpy(vport, new_vport, offsetof(struct idpf_vport, link_speed_mbps));
19581937

19591938
/* Since idpf_vport_queues_alloc was called with new_port, the queue
19601939
* back pointers are currently pointing to the local new_vport. Reset

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,6 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
233233
mutex_init(&adapter->queue_lock);
234234
mutex_init(&adapter->vc_buf_lock);
235235

236-
init_waitqueue_head(&adapter->vchnl_wq);
237-
238236
INIT_DELAYED_WORK(&adapter->init_task, idpf_init_task);
239237
INIT_DELAYED_WORK(&adapter->serv_task, idpf_service_task);
240238
INIT_DELAYED_WORK(&adapter->mbx_task, idpf_mbx_task);

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3034,28 +3034,15 @@ int idpf_vc_core_init(struct idpf_adapter *adapter)
30343034
*/
30353035
void idpf_vc_core_deinit(struct idpf_adapter *adapter)
30363036
{
3037-
int i;
3038-
30393037
idpf_vc_xn_shutdown(adapter->vcxn_mngr);
30403038
idpf_deinit_task(adapter);
30413039
idpf_intr_rel(adapter);
3042-
/* Set all bits as we dont know on which vc_state the vhnl_wq is
3043-
* waiting on and wakeup the virtchnl workqueue even if it is waiting
3044-
* for the response as we are going down
3045-
*/
3046-
for (i = 0; i < IDPF_VC_NBITS; i++)
3047-
set_bit(i, adapter->vc_state);
3048-
wake_up(&adapter->vchnl_wq);
30493040

30503041
cancel_delayed_work_sync(&adapter->serv_task);
30513042
cancel_delayed_work_sync(&adapter->mbx_task);
30523043

30533044
idpf_vport_params_buf_rel(adapter);
30543045

3055-
/* Clear all the bits */
3056-
for (i = 0; i < IDPF_VC_NBITS; i++)
3057-
clear_bit(i, adapter->vc_state);
3058-
30593046
kfree(adapter->vports);
30603047
adapter->vports = NULL;
30613048
}

0 commit comments

Comments
 (0)