Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch '200GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
refactor IDPF resource access

Pavan Kumar Linga says:

Queue and vector resources for a given vport, are stored in the
idpf_vport structure. At the time of configuration, these
resources are accessed using vport pointer. Meaning, all the
config path functions are tied to the default queue and vector
resources of the vport.

There are use cases which can make use of config path functions
to configure queue and vector resources that are not tied to any
vport. One such use case is PTP secondary mailbox creation
(it would be in a followup series). To configure queue and interrupt
resources for such cases, we can make use of the existing config
infrastructure by passing the necessary queue and vector resources info.

To achieve this, group the existing queue and vector resources into
default resource group and refactor the code to pass the resource
pointer to the config path functions.

This series also includes patches which generalizes the send virtchnl
message APIs and mailbox API that are necessary for the implementation
of PTP secondary mailbox.

* '200GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
idpf: generalize mailbox API
idpf: avoid calling get_rx_ptypes for each vport
idpf: generalize send virtchnl message API
idpf: remove vport pointer from queue sets
idpf: add rss_data field to RSS function parameters
idpf: reshuffle idpf_vport struct members to avoid holes
idpf: move some iterator declarations inside for loops
idpf: move queue resources to idpf_q_vec_rsrc structure
idpf: introduce idpf_q_vec_rsrc struct and move vector resources to it
idpf: introduce local idpf structure to store virtchnl queue chunks
====================

Link: https://patch.msgid.link/20260122223601.2208759-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+1415 -1144
+111 -68
drivers/net/ethernet/intel/idpf/idpf.h
··· 8 8 struct idpf_adapter; 9 9 struct idpf_vport; 10 10 struct idpf_vport_max_q; 11 + struct idpf_q_vec_rsrc; 12 + struct idpf_rss_data; 11 13 12 14 #include <net/pkt_sched.h> 13 15 #include <linux/aer.h> ··· 203 201 struct idpf_reg_ops { 204 202 void (*ctlq_reg_init)(struct idpf_adapter *adapter, 205 203 struct idpf_ctlq_create_info *cq); 206 - int (*intr_reg_init)(struct idpf_vport *vport); 204 + int (*intr_reg_init)(struct idpf_vport *vport, 205 + struct idpf_q_vec_rsrc *rsrc); 207 206 void (*mb_intr_reg_init)(struct idpf_adapter *adapter); 208 207 void (*reset_reg_init)(struct idpf_adapter *adapter); 209 208 void (*trigger_reset)(struct idpf_adapter *adapter, ··· 291 288 }; 292 289 293 290 /** 294 - * struct idpf_vport - Handle for netdevices and queue resources 295 - * @num_txq: Number of allocated TX queues 296 - * @num_complq: Number of allocated completion queues 291 + * struct idpf_q_vec_rsrc - handle for queue and vector resources 292 + * @dev: device pointer for DMA mapping 293 + * @q_vectors: array of queue vectors 294 + * @q_vector_idxs: starting index of queue vectors 295 + * @num_q_vectors: number of IRQ vectors allocated 296 + * @noirq_v_idx: ID of the NOIRQ vector 297 + * @noirq_dyn_ctl_ena: value to write to the above to enable it 298 + * @noirq_dyn_ctl: register to enable/disable the vector for NOIRQ queues 299 + * @txq_grps: array of TX queue groups 297 300 * @txq_desc_count: TX queue descriptor count 298 - * @complq_desc_count: Completion queue descriptor count 299 - * @compln_clean_budget: Work budget for completion clean 300 - * @num_txq_grp: Number of TX queue groups 301 - * @txq_grps: Array of TX queue groups 302 - * @txq_model: Split queue or single queue queuing model 303 - * @txqs: Used only in hotpath to get to the right queue very fast 304 - * @crc_enable: Enable CRC insertion offload 305 - * @xdpsq_share: whether XDPSQ sharing is enabled 306 - * @num_xdp_txq: number of XDPSQs 301 + * @complq_desc_count: completion queue descriptor count 302 + * @txq_model: split queue or single queue queuing model 303 + * @num_txq: number of allocated TX queues 304 + * @num_complq: number of allocated completion queues 305 + * @num_txq_grp: number of TX queue groups 307 306 * @xdp_txq_offset: index of the first XDPSQ (== number of regular SQs) 308 - * @xdp_prog: installed XDP program 309 - * @num_rxq: Number of allocated RX queues 310 - * @num_bufq: Number of allocated buffer queues 307 + * @num_rxq_grp: number of RX queues in a group 308 + * @rxq_model: splitq queue or single queue queuing model 309 + * @rxq_grps: total number of RX groups. Number of groups * number of RX per 310 + * group will yield total number of RX queues. 311 + * @num_rxq: number of allocated RX queues 312 + * @num_bufq: number of allocated buffer queues 311 313 * @rxq_desc_count: RX queue descriptor count. *MUST* have enough descriptors 312 314 * to complete all buffer descriptors for all buffer queues in 313 315 * the worst case. 314 - * @num_bufqs_per_qgrp: Buffer queues per RX queue in a given grouping 315 - * @bufq_desc_count: Buffer queue descriptor count 316 - * @num_rxq_grp: Number of RX queues in a group 317 - * @rxq_grps: Total number of RX groups. Number of groups * number of RX per 318 - * group will yield total number of RX queues. 319 - * @rxq_model: Splitq queue or single queue queuing model 320 - * @rx_ptype_lkup: Lookup table for ptypes on RX 316 + * @bufq_desc_count: buffer queue descriptor count 317 + * @num_bufqs_per_qgrp: buffer queues per RX queue in a given grouping 318 + * @base_rxd: true if the driver should use base descriptors instead of flex 319 + */ 320 + struct idpf_q_vec_rsrc { 321 + struct device *dev; 322 + struct idpf_q_vector *q_vectors; 323 + u16 *q_vector_idxs; 324 + u16 num_q_vectors; 325 + u16 noirq_v_idx; 326 + u32 noirq_dyn_ctl_ena; 327 + void __iomem *noirq_dyn_ctl; 328 + 329 + struct idpf_txq_group *txq_grps; 330 + u32 txq_desc_count; 331 + u32 complq_desc_count; 332 + u32 txq_model; 333 + u16 num_txq; 334 + u16 num_complq; 335 + u16 num_txq_grp; 336 + u16 xdp_txq_offset; 337 + 338 + u16 num_rxq_grp; 339 + u32 rxq_model; 340 + struct idpf_rxq_group *rxq_grps; 341 + u16 num_rxq; 342 + u16 num_bufq; 343 + u32 rxq_desc_count; 344 + u32 bufq_desc_count[IDPF_MAX_BUFQS_PER_RXQ_GRP]; 345 + u8 num_bufqs_per_qgrp; 346 + bool base_rxd; 347 + }; 348 + 349 + /** 350 + * struct idpf_vport - Handle for netdevices and queue resources 351 + * @dflt_qv_rsrc: contains default queue and vector resources 352 + * @txqs: Used only in hotpath to get to the right queue very fast 353 + * @num_txq: Number of allocated TX queues 354 + * @num_xdp_txq: number of XDPSQs 355 + * @xdpsq_share: whether XDPSQ sharing is enabled 356 + * @xdp_prog: installed XDP program 321 357 * @vdev_info: IDC vport device info pointer 322 358 * @adapter: back pointer to associated adapter 323 359 * @netdev: Associated net_device. Each vport should have one and only one 324 360 * associated netdev. 325 361 * @flags: See enum idpf_vport_flags 326 - * @vport_type: Default SRIOV, SIOV, etc. 362 + * @compln_clean_budget: Work budget for completion clean 327 363 * @vport_id: Device given vport identifier 364 + * @vport_type: Default SRIOV, SIOV, etc. 328 365 * @idx: Software index in adapter vports struct 329 - * @default_vport: Use this vport if one isn't specified 330 - * @base_rxd: True if the driver should use base descriptors instead of flex 331 - * @num_q_vectors: Number of IRQ vectors allocated 332 - * @q_vectors: Array of queue vectors 333 - * @q_vector_idxs: Starting index of queue vectors 334 - * @noirq_dyn_ctl: register to enable/disable the vector for NOIRQ queues 335 - * @noirq_dyn_ctl_ena: value to write to the above to enable it 336 - * @noirq_v_idx: ID of the NOIRQ vector 337 366 * @max_mtu: device given max possible MTU 338 367 * @default_mac_addr: device will give a default MAC to use 339 368 * @rx_itr_profile: RX profiles for Dynamic Interrupt Moderation 340 369 * @tx_itr_profile: TX profiles for Dynamic Interrupt Moderation 341 370 * @port_stats: per port csum, header split, and other offload stats 371 + * @default_vport: Use this vport if one isn't specified 372 + * @crc_enable: Enable CRC insertion offload 342 373 * @link_up: True if link is up 343 374 * @tx_tstamp_caps: Capabilities negotiated for Tx timestamping 344 375 * @tstamp_config: The Tx tstamp config ··· 380 343 * @tstamp_stats: Tx timestamping statistics 381 344 */ 382 345 struct idpf_vport { 383 - u16 num_txq; 384 - u16 num_complq; 385 - u32 txq_desc_count; 386 - u32 complq_desc_count; 387 - u32 compln_clean_budget; 388 - u16 num_txq_grp; 389 - struct idpf_txq_group *txq_grps; 390 - u32 txq_model; 346 + struct idpf_q_vec_rsrc dflt_qv_rsrc; 391 347 struct idpf_tx_queue **txqs; 392 - bool crc_enable; 393 - 394 - bool xdpsq_share; 348 + u16 num_txq; 395 349 u16 num_xdp_txq; 396 - u16 xdp_txq_offset; 350 + bool xdpsq_share; 397 351 struct bpf_prog *xdp_prog; 398 - 399 - u16 num_rxq; 400 - u16 num_bufq; 401 - u32 rxq_desc_count; 402 - u8 num_bufqs_per_qgrp; 403 - u32 bufq_desc_count[IDPF_MAX_BUFQS_PER_RXQ_GRP]; 404 - u16 num_rxq_grp; 405 - struct idpf_rxq_group *rxq_grps; 406 - u32 rxq_model; 407 - struct libeth_rx_pt *rx_ptype_lkup; 408 352 409 353 struct iidc_rdma_vport_dev_info *vdev_info; 410 354 411 355 struct idpf_adapter *adapter; 412 356 struct net_device *netdev; 413 357 DECLARE_BITMAP(flags, IDPF_VPORT_FLAGS_NBITS); 414 - u16 vport_type; 358 + u32 compln_clean_budget; 415 359 u32 vport_id; 360 + u16 vport_type; 416 361 u16 idx; 417 - bool default_vport; 418 - bool base_rxd; 419 - 420 - u16 num_q_vectors; 421 - struct idpf_q_vector *q_vectors; 422 - u16 *q_vector_idxs; 423 - 424 - void __iomem *noirq_dyn_ctl; 425 - u32 noirq_dyn_ctl_ena; 426 - u16 noirq_v_idx; 427 362 428 363 u16 max_mtu; 429 364 u8 default_mac_addr[ETH_ALEN]; 430 365 u16 rx_itr_profile[IDPF_DIM_PROFILE_SLOTS]; 431 366 u16 tx_itr_profile[IDPF_DIM_PROFILE_SLOTS]; 432 - struct idpf_port_stats port_stats; 433 367 368 + struct idpf_port_stats port_stats; 369 + bool default_vport; 370 + bool crc_enable; 434 371 bool link_up; 435 372 436 373 struct idpf_ptp_vport_tx_tstamp_caps *tx_tstamp_caps; ··· 561 550 }; 562 551 563 552 /** 553 + * struct idpf_queue_id_reg_chunk - individual queue ID and register chunk 554 + * @qtail_reg_start: queue tail register offset 555 + * @qtail_reg_spacing: queue tail register spacing 556 + * @type: queue type of the queues in the chunk 557 + * @start_queue_id: starting queue ID in the chunk 558 + * @num_queues: number of queues in the chunk 559 + */ 560 + struct idpf_queue_id_reg_chunk { 561 + u64 qtail_reg_start; 562 + u32 qtail_reg_spacing; 563 + u32 type; 564 + u32 start_queue_id; 565 + u32 num_queues; 566 + }; 567 + 568 + /** 569 + * struct idpf_queue_id_reg_info - queue ID and register chunk info received 570 + * over the mailbox 571 + * @num_chunks: number of chunks 572 + * @queue_chunks: array of chunks 573 + */ 574 + struct idpf_queue_id_reg_info { 575 + u16 num_chunks; 576 + struct idpf_queue_id_reg_chunk *queue_chunks; 577 + }; 578 + 579 + /** 564 580 * struct idpf_vport_config - Vport configuration data 565 581 * @user_config: see struct idpf_vport_user_config_data 566 582 * @max_q: Maximum possible queues 567 - * @req_qs_chunks: Queue chunk data for requested queues 583 + * @qid_reg_info: Struct to store the queue ID and register info 568 584 * @mac_filter_list_lock: Lock to protect mac filters 569 585 * @flow_steer_list_lock: Lock to protect fsteer filters 570 586 * @flags: See enum idpf_vport_config_flags ··· 599 561 struct idpf_vport_config { 600 562 struct idpf_vport_user_config_data user_config; 601 563 struct idpf_vport_max_q max_q; 602 - struct virtchnl2_add_queues *req_qs_chunks; 564 + struct idpf_queue_id_reg_info qid_reg_info; 603 565 spinlock_t mac_filter_list_lock; 604 566 spinlock_t flow_steer_list_lock; 605 567 DECLARE_BITMAP(flags, IDPF_VPORT_CONFIG_FLAGS_NBITS); ··· 641 603 * @vport_params_reqd: Vport params requested 642 604 * @vport_params_recvd: Vport params received 643 605 * @vport_ids: Array of device given vport identifiers 606 + * @singleq_pt_lkup: Lookup table for singleq RX ptypes 607 + * @splitq_pt_lkup: Lookup table for splitq RX ptypes 644 608 * @vport_config: Vport config parameters 645 609 * @max_vports: Maximum vports that can be allocated 646 610 * @num_alloc_vports: Current number of vports allocated ··· 700 660 struct virtchnl2_create_vport **vport_params_reqd; 701 661 struct virtchnl2_create_vport **vport_params_recvd; 702 662 u32 *vport_ids; 663 + 664 + struct libeth_rx_pt *singleq_pt_lkup; 665 + struct libeth_rx_pt *splitq_pt_lkup; 703 666 704 667 struct idpf_vport_config **vport_config; 705 668 u16 max_vports;
+10 -8
drivers/net/ethernet/intel/idpf/idpf_dev.c
··· 70 70 /** 71 71 * idpf_intr_reg_init - Initialize interrupt registers 72 72 * @vport: virtual port structure 73 + * @rsrc: pointer to queue and vector resources 73 74 */ 74 - static int idpf_intr_reg_init(struct idpf_vport *vport) 75 + static int idpf_intr_reg_init(struct idpf_vport *vport, 76 + struct idpf_q_vec_rsrc *rsrc) 75 77 { 76 78 struct idpf_adapter *adapter = vport->adapter; 77 - int num_vecs = vport->num_q_vectors; 79 + u16 num_vecs = rsrc->num_q_vectors; 78 80 struct idpf_vec_regs *reg_vals; 79 81 int num_regs, i, err = 0; 80 82 u32 rx_itr, tx_itr, val; ··· 88 86 if (!reg_vals) 89 87 return -ENOMEM; 90 88 91 - num_regs = idpf_get_reg_intr_vecs(vport, reg_vals); 89 + num_regs = idpf_get_reg_intr_vecs(adapter, reg_vals); 92 90 if (num_regs < num_vecs) { 93 91 err = -EINVAL; 94 92 goto free_reg_vals; 95 93 } 96 94 97 95 for (i = 0; i < num_vecs; i++) { 98 - struct idpf_q_vector *q_vector = &vport->q_vectors[i]; 99 - u16 vec_id = vport->q_vector_idxs[i] - IDPF_MBX_Q_VEC; 96 + struct idpf_q_vector *q_vector = &rsrc->q_vectors[i]; 97 + u16 vec_id = rsrc->q_vector_idxs[i] - IDPF_MBX_Q_VEC; 100 98 struct idpf_intr_reg *intr = &q_vector->intr_reg; 101 99 u32 spacing; 102 100 ··· 125 123 126 124 /* Data vector for NOIRQ queues */ 127 125 128 - val = reg_vals[vport->q_vector_idxs[i] - IDPF_MBX_Q_VEC].dyn_ctl_reg; 129 - vport->noirq_dyn_ctl = idpf_get_reg_addr(adapter, val); 126 + val = reg_vals[rsrc->q_vector_idxs[i] - IDPF_MBX_Q_VEC].dyn_ctl_reg; 127 + rsrc->noirq_dyn_ctl = idpf_get_reg_addr(adapter, val); 130 128 131 129 val = PF_GLINT_DYN_CTL_WB_ON_ITR_M | PF_GLINT_DYN_CTL_INTENA_MSK_M | 132 130 FIELD_PREP(PF_GLINT_DYN_CTL_ITR_INDX_M, IDPF_NO_ITR_UPDATE_IDX); 133 - vport->noirq_dyn_ctl_ena = val; 131 + rsrc->noirq_dyn_ctl_ena = val; 134 132 135 133 free_reg_vals: 136 134 kfree(reg_vals);
+52 -41
drivers/net/ethernet/intel/idpf/idpf_ethtool.c
··· 18 18 19 19 idpf_vport_ctrl_lock(netdev); 20 20 vport = idpf_netdev_to_vport(netdev); 21 - num_rxq = vport->num_rxq; 21 + num_rxq = vport->dflt_qv_rsrc.num_rxq; 22 22 idpf_vport_ctrl_unlock(netdev); 23 23 24 24 return num_rxq; ··· 503 503 } 504 504 505 505 if (test_bit(IDPF_VPORT_UP, np->state)) 506 - err = idpf_config_rss(vport); 506 + err = idpf_config_rss(vport, rss_data); 507 507 508 508 unlock_mutex: 509 509 idpf_vport_ctrl_unlock(netdev); ··· 644 644 645 645 ring->rx_max_pending = IDPF_MAX_RXQ_DESC; 646 646 ring->tx_max_pending = IDPF_MAX_TXQ_DESC; 647 - ring->rx_pending = vport->rxq_desc_count; 648 - ring->tx_pending = vport->txq_desc_count; 647 + ring->rx_pending = vport->dflt_qv_rsrc.rxq_desc_count; 648 + ring->tx_pending = vport->dflt_qv_rsrc.txq_desc_count; 649 649 650 650 kring->tcp_data_split = idpf_vport_get_hsplit(vport); 651 651 ··· 669 669 { 670 670 struct idpf_vport_user_config_data *config_data; 671 671 u32 new_rx_count, new_tx_count; 672 + struct idpf_q_vec_rsrc *rsrc; 672 673 struct idpf_vport *vport; 673 - int i, err = 0; 674 + int err = 0; 674 675 u16 idx; 675 676 676 677 idpf_vport_ctrl_lock(netdev); ··· 705 704 netdev_info(netdev, "Requested Tx descriptor count rounded up to %u\n", 706 705 new_tx_count); 707 706 708 - if (new_tx_count == vport->txq_desc_count && 709 - new_rx_count == vport->rxq_desc_count && 707 + rsrc = &vport->dflt_qv_rsrc; 708 + if (new_tx_count == rsrc->txq_desc_count && 709 + new_rx_count == rsrc->rxq_desc_count && 710 710 kring->tcp_data_split == idpf_vport_get_hsplit(vport)) 711 711 goto unlock_mutex; 712 712 ··· 726 724 /* Since we adjusted the RX completion queue count, the RX buffer queue 727 725 * descriptor count needs to be adjusted as well 728 726 */ 729 - for (i = 0; i < vport->num_bufqs_per_qgrp; i++) 730 - vport->bufq_desc_count[i] = 727 + for (unsigned int i = 0; i < rsrc->num_bufqs_per_qgrp; i++) 728 + rsrc->bufq_desc_count[i] = 731 729 IDPF_RX_BUFQ_DESC_COUNT(new_rx_count, 732 - vport->num_bufqs_per_qgrp); 730 + rsrc->num_bufqs_per_qgrp); 733 731 734 732 err = idpf_initiate_soft_reset(vport, IDPF_SR_Q_DESC_CHANGE); 735 733 ··· 1106 1104 static void idpf_collect_queue_stats(struct idpf_vport *vport) 1107 1105 { 1108 1106 struct idpf_port_stats *pstats = &vport->port_stats; 1109 - int i, j; 1107 + struct idpf_q_vec_rsrc *rsrc = &vport->dflt_qv_rsrc; 1110 1108 1111 1109 /* zero out port stats since they're actually tracked in per 1112 1110 * queue stats; this is only for reporting ··· 1122 1120 u64_stats_set(&pstats->tx_dma_map_errs, 0); 1123 1121 u64_stats_update_end(&pstats->stats_sync); 1124 1122 1125 - for (i = 0; i < vport->num_rxq_grp; i++) { 1126 - struct idpf_rxq_group *rxq_grp = &vport->rxq_grps[i]; 1123 + for (unsigned int i = 0; i < rsrc->num_rxq_grp; i++) { 1124 + struct idpf_rxq_group *rxq_grp = &rsrc->rxq_grps[i]; 1127 1125 u16 num_rxq; 1128 1126 1129 - if (idpf_is_queue_model_split(vport->rxq_model)) 1127 + if (idpf_is_queue_model_split(rsrc->rxq_model)) 1130 1128 num_rxq = rxq_grp->splitq.num_rxq_sets; 1131 1129 else 1132 1130 num_rxq = rxq_grp->singleq.num_rxq; 1133 1131 1134 - for (j = 0; j < num_rxq; j++) { 1132 + for (unsigned int j = 0; j < num_rxq; j++) { 1135 1133 u64 hw_csum_err, hsplit, hsplit_hbo, bad_descs; 1136 1134 struct idpf_rx_queue_stats *stats; 1137 1135 struct idpf_rx_queue *rxq; 1138 1136 unsigned int start; 1139 1137 1140 - if (idpf_is_queue_model_split(vport->rxq_model)) 1138 + if (idpf_is_queue_model_split(rsrc->rxq_model)) 1141 1139 rxq = &rxq_grp->splitq.rxq_sets[j]->rxq; 1142 1140 else 1143 1141 rxq = rxq_grp->singleq.rxqs[j]; ··· 1164 1162 } 1165 1163 } 1166 1164 1167 - for (i = 0; i < vport->num_txq_grp; i++) { 1168 - struct idpf_txq_group *txq_grp = &vport->txq_grps[i]; 1165 + for (unsigned int i = 0; i < rsrc->num_txq_grp; i++) { 1166 + struct idpf_txq_group *txq_grp = &rsrc->txq_grps[i]; 1169 1167 1170 - for (j = 0; j < txq_grp->num_txq; j++) { 1168 + for (unsigned int j = 0; j < txq_grp->num_txq; j++) { 1171 1169 u64 linearize, qbusy, skb_drops, dma_map_errs; 1172 1170 struct idpf_tx_queue *txq = txq_grp->txqs[j]; 1173 1171 struct idpf_tx_queue_stats *stats; ··· 1210 1208 { 1211 1209 struct idpf_netdev_priv *np = netdev_priv(netdev); 1212 1210 struct idpf_vport_config *vport_config; 1211 + struct idpf_q_vec_rsrc *rsrc; 1213 1212 struct idpf_vport *vport; 1214 1213 unsigned int total = 0; 1215 - unsigned int i, j; 1216 1214 bool is_splitq; 1217 1215 u16 qtype; 1218 1216 ··· 1230 1228 idpf_collect_queue_stats(vport); 1231 1229 idpf_add_port_stats(vport, &data); 1232 1230 1233 - for (i = 0; i < vport->num_txq_grp; i++) { 1234 - struct idpf_txq_group *txq_grp = &vport->txq_grps[i]; 1231 + rsrc = &vport->dflt_qv_rsrc; 1232 + for (unsigned int i = 0; i < rsrc->num_txq_grp; i++) { 1233 + struct idpf_txq_group *txq_grp = &rsrc->txq_grps[i]; 1235 1234 1236 1235 qtype = VIRTCHNL2_QUEUE_TYPE_TX; 1237 1236 1238 - for (j = 0; j < txq_grp->num_txq; j++, total++) { 1237 + for (unsigned int j = 0; j < txq_grp->num_txq; j++, total++) { 1239 1238 struct idpf_tx_queue *txq = txq_grp->txqs[j]; 1240 1239 1241 1240 if (!txq) ··· 1256 1253 idpf_add_empty_queue_stats(&data, VIRTCHNL2_QUEUE_TYPE_TX); 1257 1254 total = 0; 1258 1255 1259 - is_splitq = idpf_is_queue_model_split(vport->rxq_model); 1256 + is_splitq = idpf_is_queue_model_split(rsrc->rxq_model); 1260 1257 1261 - for (i = 0; i < vport->num_rxq_grp; i++) { 1262 - struct idpf_rxq_group *rxq_grp = &vport->rxq_grps[i]; 1258 + for (unsigned int i = 0; i < rsrc->num_rxq_grp; i++) { 1259 + struct idpf_rxq_group *rxq_grp = &rsrc->rxq_grps[i]; 1263 1260 u16 num_rxq; 1264 1261 1265 1262 qtype = VIRTCHNL2_QUEUE_TYPE_RX; ··· 1269 1266 else 1270 1267 num_rxq = rxq_grp->singleq.num_rxq; 1271 1268 1272 - for (j = 0; j < num_rxq; j++, total++) { 1269 + for (unsigned int j = 0; j < num_rxq; j++, total++) { 1273 1270 struct idpf_rx_queue *rxq; 1274 1271 1275 1272 if (is_splitq) ··· 1301 1298 struct idpf_q_vector *idpf_find_rxq_vec(const struct idpf_vport *vport, 1302 1299 u32 q_num) 1303 1300 { 1301 + const struct idpf_q_vec_rsrc *rsrc = &vport->dflt_qv_rsrc; 1304 1302 int q_grp, q_idx; 1305 1303 1306 - if (!idpf_is_queue_model_split(vport->rxq_model)) 1307 - return vport->rxq_grps->singleq.rxqs[q_num]->q_vector; 1304 + if (!idpf_is_queue_model_split(rsrc->rxq_model)) 1305 + return rsrc->rxq_grps->singleq.rxqs[q_num]->q_vector; 1308 1306 1309 1307 q_grp = q_num / IDPF_DFLT_SPLITQ_RXQ_PER_GROUP; 1310 1308 q_idx = q_num % IDPF_DFLT_SPLITQ_RXQ_PER_GROUP; 1311 1309 1312 - return vport->rxq_grps[q_grp].splitq.rxq_sets[q_idx]->rxq.q_vector; 1310 + return rsrc->rxq_grps[q_grp].splitq.rxq_sets[q_idx]->rxq.q_vector; 1313 1311 } 1314 1312 1315 1313 /** ··· 1323 1319 struct idpf_q_vector *idpf_find_txq_vec(const struct idpf_vport *vport, 1324 1320 u32 q_num) 1325 1321 { 1322 + const struct idpf_q_vec_rsrc *rsrc = &vport->dflt_qv_rsrc; 1326 1323 int q_grp; 1327 1324 1328 - if (!idpf_is_queue_model_split(vport->txq_model)) 1325 + if (!idpf_is_queue_model_split(rsrc->txq_model)) 1329 1326 return vport->txqs[q_num]->q_vector; 1330 1327 1331 1328 q_grp = q_num / IDPF_DFLT_SPLITQ_TXQ_PER_GROUP; 1332 1329 1333 - return vport->txq_grps[q_grp].complq->q_vector; 1330 + return rsrc->txq_grps[q_grp].complq->q_vector; 1334 1331 } 1335 1332 1336 1333 /** ··· 1368 1363 u32 q_num) 1369 1364 { 1370 1365 const struct idpf_netdev_priv *np = netdev_priv(netdev); 1371 - const struct idpf_vport *vport; 1366 + struct idpf_q_vec_rsrc *rsrc; 1367 + struct idpf_vport *vport; 1372 1368 int err = 0; 1373 1369 1374 1370 idpf_vport_ctrl_lock(netdev); ··· 1378 1372 if (!test_bit(IDPF_VPORT_UP, np->state)) 1379 1373 goto unlock_mutex; 1380 1374 1381 - if (q_num >= vport->num_rxq && q_num >= vport->num_txq) { 1375 + rsrc = &vport->dflt_qv_rsrc; 1376 + if (q_num >= rsrc->num_rxq && q_num >= rsrc->num_txq) { 1382 1377 err = -EINVAL; 1383 1378 goto unlock_mutex; 1384 1379 } 1385 1380 1386 - if (q_num < vport->num_rxq) 1381 + if (q_num < rsrc->num_rxq) 1387 1382 __idpf_get_q_coalesce(ec, idpf_find_rxq_vec(vport, q_num), 1388 1383 VIRTCHNL2_QUEUE_TYPE_RX); 1389 1384 1390 - if (q_num < vport->num_txq) 1385 + if (q_num < rsrc->num_txq) 1391 1386 __idpf_get_q_coalesce(ec, idpf_find_txq_vec(vport, q_num), 1392 1387 VIRTCHNL2_QUEUE_TYPE_TX); 1393 1388 ··· 1556 1549 struct idpf_netdev_priv *np = netdev_priv(netdev); 1557 1550 struct idpf_vport_user_config_data *user_config; 1558 1551 struct idpf_q_coalesce *q_coal; 1552 + struct idpf_q_vec_rsrc *rsrc; 1559 1553 struct idpf_vport *vport; 1560 - int i, err = 0; 1554 + int err = 0; 1561 1555 1562 1556 user_config = &np->adapter->vport_config[np->vport_idx]->user_config; 1563 1557 ··· 1568 1560 if (!test_bit(IDPF_VPORT_UP, np->state)) 1569 1561 goto unlock_mutex; 1570 1562 1571 - for (i = 0; i < vport->num_txq; i++) { 1563 + rsrc = &vport->dflt_qv_rsrc; 1564 + for (unsigned int i = 0; i < rsrc->num_txq; i++) { 1572 1565 q_coal = &user_config->q_coalesce[i]; 1573 1566 err = idpf_set_q_coalesce(vport, q_coal, ec, i, false); 1574 1567 if (err) 1575 1568 goto unlock_mutex; 1576 1569 } 1577 1570 1578 - for (i = 0; i < vport->num_rxq; i++) { 1571 + for (unsigned int i = 0; i < rsrc->num_rxq; i++) { 1579 1572 q_coal = &user_config->q_coalesce[i]; 1580 1573 err = idpf_set_q_coalesce(vport, q_coal, ec, i, true); 1581 1574 if (err) ··· 1757 1748 struct ethtool_ts_stats *ts_stats) 1758 1749 { 1759 1750 struct idpf_netdev_priv *np = netdev_priv(netdev); 1751 + struct idpf_q_vec_rsrc *rsrc; 1760 1752 struct idpf_vport *vport; 1761 1753 unsigned int start; 1762 1754 ··· 1773 1763 if (!test_bit(IDPF_VPORT_UP, np->state)) 1774 1764 goto exit; 1775 1765 1776 - for (u16 i = 0; i < vport->num_txq_grp; i++) { 1777 - struct idpf_txq_group *txq_grp = &vport->txq_grps[i]; 1766 + rsrc = &vport->dflt_qv_rsrc; 1767 + for (u16 i = 0; i < rsrc->num_txq_grp; i++) { 1768 + struct idpf_txq_group *txq_grp = &rsrc->txq_grps[i]; 1778 1769 1779 1770 for (u16 j = 0; j < txq_grp->num_txq; j++) { 1780 1771 struct idpf_tx_queue *txq = txq_grp->txqs[j];
+130 -95
drivers/net/ethernet/intel/idpf/idpf_lib.c
··· 545 545 if (test_bit(IDPF_VPORT_UP, np->state)) { 546 546 int err; 547 547 548 - err = idpf_add_del_mac_filters(vport, np, false, async); 548 + err = idpf_add_del_mac_filters(np->adapter, vport_config, 549 + vport->default_mac_addr, 550 + np->vport_id, false, async); 549 551 if (err) 550 552 return err; 551 553 } ··· 616 614 return err; 617 615 618 616 if (test_bit(IDPF_VPORT_UP, np->state)) 619 - err = idpf_add_del_mac_filters(vport, np, true, async); 617 + err = idpf_add_del_mac_filters(np->adapter, vport_config, 618 + vport->default_mac_addr, 619 + np->vport_id, true, async); 620 620 621 621 return err; 622 622 } ··· 666 662 667 663 spin_unlock_bh(&vport_config->mac_filter_list_lock); 668 664 669 - idpf_add_del_mac_filters(vport, netdev_priv(vport->netdev), 665 + idpf_add_del_mac_filters(vport->adapter, vport_config, 666 + vport->default_mac_addr, vport->vport_id, 670 667 true, false); 671 668 } 672 669 ··· 691 686 692 687 spin_unlock_bh(&vport_config->mac_filter_list_lock); 693 688 694 - idpf_add_del_mac_filters(vport, netdev_priv(vport->netdev), 689 + idpf_add_del_mac_filters(vport->adapter, vport_config, 690 + vport->default_mac_addr, vport->vport_id, 695 691 false, false); 696 692 } 697 693 ··· 981 975 static void idpf_vport_stop(struct idpf_vport *vport, bool rtnl) 982 976 { 983 977 struct idpf_netdev_priv *np = netdev_priv(vport->netdev); 978 + struct idpf_q_vec_rsrc *rsrc = &vport->dflt_qv_rsrc; 979 + struct idpf_adapter *adapter = vport->adapter; 980 + struct idpf_queue_id_reg_info *chunks; 981 + u32 vport_id = vport->vport_id; 984 982 985 983 if (!test_bit(IDPF_VPORT_UP, np->state)) 986 984 return; ··· 995 985 netif_carrier_off(vport->netdev); 996 986 netif_tx_disable(vport->netdev); 997 987 998 - idpf_send_disable_vport_msg(vport); 988 + chunks = &adapter->vport_config[vport->idx]->qid_reg_info; 989 + 990 + idpf_send_disable_vport_msg(adapter, vport_id); 999 991 idpf_send_disable_queues_msg(vport); 1000 - idpf_send_map_unmap_queue_vector_msg(vport, false); 992 + idpf_send_map_unmap_queue_vector_msg(adapter, rsrc, vport_id, false); 1001 993 /* Normally we ask for queues in create_vport, but if the number of 1002 994 * initially requested queues have changed, for example via ethtool 1003 995 * set channels, we do delete queues and then add the queues back 1004 996 * instead of deleting and reallocating the vport. 1005 997 */ 1006 998 if (test_and_clear_bit(IDPF_VPORT_DEL_QUEUES, vport->flags)) 1007 - idpf_send_delete_queues_msg(vport); 999 + idpf_send_delete_queues_msg(adapter, chunks, vport_id); 1008 1000 1009 1001 idpf_remove_features(vport); 1010 1002 1011 1003 vport->link_up = false; 1012 - idpf_vport_intr_deinit(vport); 1013 - idpf_xdp_rxq_info_deinit_all(vport); 1014 - idpf_vport_queues_rel(vport); 1015 - idpf_vport_intr_rel(vport); 1004 + idpf_vport_intr_deinit(vport, rsrc); 1005 + idpf_xdp_rxq_info_deinit_all(rsrc); 1006 + idpf_vport_queues_rel(vport, rsrc); 1007 + idpf_vport_intr_rel(rsrc); 1016 1008 clear_bit(IDPF_VPORT_UP, np->state); 1017 1009 1018 1010 if (rtnl) ··· 1058 1046 struct idpf_adapter *adapter = vport->adapter; 1059 1047 u16 idx = vport->idx; 1060 1048 1061 - kfree(vport->rx_ptype_lkup); 1062 - vport->rx_ptype_lkup = NULL; 1063 - 1064 1049 if (test_and_clear_bit(IDPF_VPORT_REG_NETDEV, 1065 1050 adapter->vport_config[idx]->flags)) { 1066 1051 unregister_netdev(vport->netdev); ··· 1074 1065 */ 1075 1066 static void idpf_vport_rel(struct idpf_vport *vport) 1076 1067 { 1068 + struct idpf_q_vec_rsrc *rsrc = &vport->dflt_qv_rsrc; 1077 1069 struct idpf_adapter *adapter = vport->adapter; 1078 1070 struct idpf_vport_config *vport_config; 1079 1071 struct idpf_vector_info vec_info; ··· 1083 1073 u16 idx = vport->idx; 1084 1074 1085 1075 vport_config = adapter->vport_config[vport->idx]; 1086 - idpf_deinit_rss_lut(vport); 1087 1076 rss_data = &vport_config->user_config.rss_data; 1077 + idpf_deinit_rss_lut(rss_data); 1088 1078 kfree(rss_data->rss_key); 1089 1079 rss_data->rss_key = NULL; 1090 1080 1091 - idpf_send_destroy_vport_msg(vport); 1081 + idpf_send_destroy_vport_msg(adapter, vport->vport_id); 1092 1082 1093 1083 /* Release all max queues allocated to the adapter's pool */ 1094 1084 max_q.max_rxq = vport_config->max_q.max_rxq; ··· 1099 1089 1100 1090 /* Release all the allocated vectors on the stack */ 1101 1091 vec_info.num_req_vecs = 0; 1102 - vec_info.num_curr_vecs = vport->num_q_vectors; 1092 + vec_info.num_curr_vecs = rsrc->num_q_vectors; 1103 1093 vec_info.default_vport = vport->default_vport; 1104 1094 1105 - idpf_req_rel_vector_indexes(adapter, vport->q_vector_idxs, &vec_info); 1095 + idpf_req_rel_vector_indexes(adapter, rsrc->q_vector_idxs, &vec_info); 1106 1096 1107 - kfree(vport->q_vector_idxs); 1108 - vport->q_vector_idxs = NULL; 1097 + kfree(rsrc->q_vector_idxs); 1098 + rsrc->q_vector_idxs = NULL; 1099 + 1100 + idpf_vport_deinit_queue_reg_chunks(vport_config); 1109 1101 1110 1102 kfree(adapter->vport_params_recvd[idx]); 1111 1103 adapter->vport_params_recvd[idx] = NULL; 1112 1104 kfree(adapter->vport_params_reqd[idx]); 1113 1105 adapter->vport_params_reqd[idx] = NULL; 1114 - if (adapter->vport_config[idx]) { 1115 - kfree(adapter->vport_config[idx]->req_qs_chunks); 1116 - adapter->vport_config[idx]->req_qs_chunks = NULL; 1117 - } 1118 - kfree(vport->rx_ptype_lkup); 1119 - vport->rx_ptype_lkup = NULL; 1106 + 1120 1107 kfree(vport); 1121 1108 adapter->num_alloc_vports--; 1122 1109 } ··· 1162 1155 */ 1163 1156 static bool idpf_is_hsplit_supported(const struct idpf_vport *vport) 1164 1157 { 1165 - return idpf_is_queue_model_split(vport->rxq_model) && 1158 + return idpf_is_queue_model_split(vport->dflt_qv_rsrc.rxq_model) && 1166 1159 idpf_is_cap_ena_all(vport->adapter, IDPF_HSPLIT_CAPS, 1167 1160 IDPF_CAP_HSPLIT); 1168 1161 } ··· 1231 1224 { 1232 1225 struct idpf_rss_data *rss_data; 1233 1226 u16 idx = adapter->next_vport; 1227 + struct idpf_q_vec_rsrc *rsrc; 1234 1228 struct idpf_vport *vport; 1235 1229 u16 num_max_q; 1236 1230 int err; ··· 1279 1271 vport->default_vport = adapter->num_alloc_vports < 1280 1272 idpf_get_default_vports(adapter); 1281 1273 1282 - vport->q_vector_idxs = kcalloc(num_max_q, sizeof(u16), GFP_KERNEL); 1283 - if (!vport->q_vector_idxs) 1274 + rsrc = &vport->dflt_qv_rsrc; 1275 + rsrc->dev = &adapter->pdev->dev; 1276 + rsrc->q_vector_idxs = kcalloc(num_max_q, sizeof(u16), GFP_KERNEL); 1277 + if (!rsrc->q_vector_idxs) 1284 1278 goto free_vport; 1285 1279 1286 - idpf_vport_init(vport, max_q); 1280 + err = idpf_vport_init(vport, max_q); 1281 + if (err) 1282 + goto free_vector_idxs; 1287 1283 1288 1284 /* LUT and key are both initialized here. Key is not strictly dependent 1289 1285 * on how many queues we have. If we change number of queues and soft ··· 1298 1286 rss_data = &adapter->vport_config[idx]->user_config.rss_data; 1299 1287 rss_data->rss_key = kzalloc(rss_data->rss_key_size, GFP_KERNEL); 1300 1288 if (!rss_data->rss_key) 1301 - goto free_vector_idxs; 1289 + goto free_qreg_chunks; 1302 1290 1303 - /* Initialize default rss key */ 1291 + /* Initialize default RSS key */ 1304 1292 netdev_rss_key_fill((void *)rss_data->rss_key, rss_data->rss_key_size); 1305 1293 1306 - /* Initialize default rss LUT */ 1307 - err = idpf_init_rss_lut(vport); 1294 + /* Initialize default RSS LUT */ 1295 + err = idpf_init_rss_lut(vport, rss_data); 1308 1296 if (err) 1309 1297 goto free_rss_key; 1310 1298 ··· 1320 1308 1321 1309 free_rss_key: 1322 1310 kfree(rss_data->rss_key); 1311 + free_qreg_chunks: 1312 + idpf_vport_deinit_queue_reg_chunks(adapter->vport_config[idx]); 1323 1313 free_vector_idxs: 1324 - kfree(vport->q_vector_idxs); 1314 + kfree(rsrc->q_vector_idxs); 1325 1315 free_vport: 1326 1316 kfree(vport); 1327 1317 ··· 1360 1346 struct idpf_vport *vport = adapter->vports[i]; 1361 1347 1362 1348 if (vport && !test_bit(IDPF_HR_RESET_IN_PROG, adapter->flags)) 1363 - idpf_send_get_stats_msg(vport); 1349 + idpf_send_get_stats_msg(netdev_priv(vport->netdev), 1350 + &vport->port_stats); 1364 1351 } 1365 1352 1366 1353 queue_delayed_work(adapter->stats_wq, &adapter->stats_task, ··· 1384 1369 queue_delayed_work(adapter->mbx_wq, &adapter->mbx_task, 1385 1370 usecs_to_jiffies(300)); 1386 1371 1387 - idpf_recv_mb_msg(adapter); 1372 + idpf_recv_mb_msg(adapter, adapter->hw.arq); 1388 1373 } 1389 1374 1390 1375 /** ··· 1432 1417 */ 1433 1418 static int idpf_set_real_num_queues(struct idpf_vport *vport) 1434 1419 { 1435 - int err, txq = vport->num_txq - vport->num_xdp_txq; 1420 + int err, txq = vport->dflt_qv_rsrc.num_txq - vport->num_xdp_txq; 1436 1421 1437 - err = netif_set_real_num_rx_queues(vport->netdev, vport->num_rxq); 1422 + err = netif_set_real_num_rx_queues(vport->netdev, 1423 + vport->dflt_qv_rsrc.num_rxq); 1438 1424 if (err) 1439 1425 return err; 1440 1426 ··· 1460 1444 1461 1445 /** 1462 1446 * idpf_rx_init_buf_tail - Write initial buffer ring tail value 1463 - * @vport: virtual port struct 1447 + * @rsrc: pointer to queue and vector resources 1464 1448 */ 1465 - static void idpf_rx_init_buf_tail(struct idpf_vport *vport) 1449 + static void idpf_rx_init_buf_tail(struct idpf_q_vec_rsrc *rsrc) 1466 1450 { 1467 - int i, j; 1451 + for (unsigned int i = 0; i < rsrc->num_rxq_grp; i++) { 1452 + struct idpf_rxq_group *grp = &rsrc->rxq_grps[i]; 1468 1453 1469 - for (i = 0; i < vport->num_rxq_grp; i++) { 1470 - struct idpf_rxq_group *grp = &vport->rxq_grps[i]; 1471 - 1472 - if (idpf_is_queue_model_split(vport->rxq_model)) { 1473 - for (j = 0; j < vport->num_bufqs_per_qgrp; j++) { 1454 + if (idpf_is_queue_model_split(rsrc->rxq_model)) { 1455 + for (unsigned int j = 0; j < rsrc->num_bufqs_per_qgrp; j++) { 1474 1456 const struct idpf_buf_queue *q = 1475 1457 &grp->splitq.bufq_sets[j].bufq; 1476 1458 1477 1459 writel(q->next_to_alloc, q->tail); 1478 1460 } 1479 1461 } else { 1480 - for (j = 0; j < grp->singleq.num_rxq; j++) { 1462 + for (unsigned int j = 0; j < grp->singleq.num_rxq; j++) { 1481 1463 const struct idpf_rx_queue *q = 1482 1464 grp->singleq.rxqs[j]; 1483 1465 ··· 1493 1479 static int idpf_vport_open(struct idpf_vport *vport, bool rtnl) 1494 1480 { 1495 1481 struct idpf_netdev_priv *np = netdev_priv(vport->netdev); 1482 + struct idpf_q_vec_rsrc *rsrc = &vport->dflt_qv_rsrc; 1496 1483 struct idpf_adapter *adapter = vport->adapter; 1484 + struct idpf_vport_config *vport_config; 1485 + struct idpf_queue_id_reg_info *chunks; 1486 + struct idpf_rss_data *rss_data; 1487 + u32 vport_id = vport->vport_id; 1497 1488 int err; 1498 1489 1499 1490 if (test_bit(IDPF_VPORT_UP, np->state)) ··· 1510 1491 /* we do not allow interface up just yet */ 1511 1492 netif_carrier_off(vport->netdev); 1512 1493 1513 - err = idpf_vport_intr_alloc(vport); 1494 + err = idpf_vport_intr_alloc(vport, rsrc); 1514 1495 if (err) { 1515 1496 dev_err(&adapter->pdev->dev, "Failed to allocate interrupts for vport %u: %d\n", 1516 1497 vport->vport_id, err); 1517 1498 goto err_rtnl_unlock; 1518 1499 } 1519 1500 1520 - err = idpf_vport_queues_alloc(vport); 1501 + err = idpf_vport_queues_alloc(vport, rsrc); 1521 1502 if (err) 1522 1503 goto intr_rel; 1523 1504 1524 - err = idpf_vport_queue_ids_init(vport); 1505 + vport_config = adapter->vport_config[vport->idx]; 1506 + chunks = &vport_config->qid_reg_info; 1507 + 1508 + err = idpf_vport_queue_ids_init(vport, rsrc, chunks); 1525 1509 if (err) { 1526 1510 dev_err(&adapter->pdev->dev, "Failed to initialize queue ids for vport %u: %d\n", 1527 1511 vport->vport_id, err); 1528 1512 goto queues_rel; 1529 1513 } 1530 1514 1531 - err = idpf_vport_intr_init(vport); 1515 + err = idpf_vport_intr_init(vport, rsrc); 1532 1516 if (err) { 1533 1517 dev_err(&adapter->pdev->dev, "Failed to initialize interrupts for vport %u: %d\n", 1534 1518 vport->vport_id, err); 1535 1519 goto queues_rel; 1536 1520 } 1537 1521 1538 - err = idpf_queue_reg_init(vport); 1522 + err = idpf_queue_reg_init(vport, rsrc, chunks); 1539 1523 if (err) { 1540 1524 dev_err(&adapter->pdev->dev, "Failed to initialize queue registers for vport %u: %d\n", 1541 1525 vport->vport_id, err); 1542 1526 goto intr_deinit; 1543 1527 } 1544 1528 1545 - err = idpf_rx_bufs_init_all(vport); 1529 + err = idpf_rx_bufs_init_all(vport, rsrc); 1546 1530 if (err) { 1547 1531 dev_err(&adapter->pdev->dev, "Failed to initialize RX buffers for vport %u: %d\n", 1548 1532 vport->vport_id, err); 1549 1533 goto intr_deinit; 1550 1534 } 1551 1535 1552 - idpf_rx_init_buf_tail(vport); 1536 + idpf_rx_init_buf_tail(rsrc); 1553 1537 1554 - err = idpf_xdp_rxq_info_init_all(vport); 1538 + err = idpf_xdp_rxq_info_init_all(rsrc); 1555 1539 if (err) { 1556 1540 netdev_err(vport->netdev, 1557 1541 "Failed to initialize XDP RxQ info for vport %u: %pe\n", ··· 1562 1540 goto intr_deinit; 1563 1541 } 1564 1542 1565 - idpf_vport_intr_ena(vport); 1543 + idpf_vport_intr_ena(vport, rsrc); 1566 1544 1567 - err = idpf_send_config_queues_msg(vport); 1545 + err = idpf_send_config_queues_msg(adapter, rsrc, vport_id); 1568 1546 if (err) { 1569 1547 dev_err(&adapter->pdev->dev, "Failed to configure queues for vport %u, %d\n", 1570 1548 vport->vport_id, err); 1571 1549 goto rxq_deinit; 1572 1550 } 1573 1551 1574 - err = idpf_send_map_unmap_queue_vector_msg(vport, true); 1552 + err = idpf_send_map_unmap_queue_vector_msg(adapter, rsrc, vport_id, 1553 + true); 1575 1554 if (err) { 1576 1555 dev_err(&adapter->pdev->dev, "Failed to map queue vectors for vport %u: %d\n", 1577 1556 vport->vport_id, err); ··· 1586 1563 goto unmap_queue_vectors; 1587 1564 } 1588 1565 1589 - err = idpf_send_enable_vport_msg(vport); 1566 + err = idpf_send_enable_vport_msg(adapter, vport_id); 1590 1567 if (err) { 1591 1568 dev_err(&adapter->pdev->dev, "Failed to enable vport %u: %d\n", 1592 1569 vport->vport_id, err); ··· 1596 1573 1597 1574 idpf_restore_features(vport); 1598 1575 1599 - err = idpf_config_rss(vport); 1576 + rss_data = &vport_config->user_config.rss_data; 1577 + err = idpf_config_rss(vport, rss_data); 1600 1578 if (err) { 1601 1579 dev_err(&adapter->pdev->dev, "Failed to configure RSS for vport %u: %d\n", 1602 1580 vport->vport_id, err); ··· 1612 1588 return 0; 1613 1589 1614 1590 disable_vport: 1615 - idpf_send_disable_vport_msg(vport); 1591 + idpf_send_disable_vport_msg(adapter, vport_id); 1616 1592 disable_queues: 1617 1593 idpf_send_disable_queues_msg(vport); 1618 1594 unmap_queue_vectors: 1619 - idpf_send_map_unmap_queue_vector_msg(vport, false); 1595 + idpf_send_map_unmap_queue_vector_msg(adapter, rsrc, vport_id, false); 1620 1596 rxq_deinit: 1621 - idpf_xdp_rxq_info_deinit_all(vport); 1597 + idpf_xdp_rxq_info_deinit_all(rsrc); 1622 1598 intr_deinit: 1623 - idpf_vport_intr_deinit(vport); 1599 + idpf_vport_intr_deinit(vport, rsrc); 1624 1600 queues_rel: 1625 - idpf_vport_queues_rel(vport); 1601 + idpf_vport_queues_rel(vport, rsrc); 1626 1602 intr_rel: 1627 - idpf_vport_intr_rel(vport); 1603 + idpf_vport_intr_rel(rsrc); 1628 1604 1629 1605 err_rtnl_unlock: 1630 1606 if (rtnl) ··· 1681 1657 idpf_vport_dealloc_max_qs(adapter, &max_q); 1682 1658 goto unwind_vports; 1683 1659 } 1684 - 1685 - err = idpf_send_get_rx_ptype_msg(vport); 1686 - if (err) 1687 - goto unwind_vports; 1688 1660 1689 1661 index = vport->idx; 1690 1662 vport_config = adapter->vport_config[index]; ··· 2007 1987 { 2008 1988 struct idpf_netdev_priv *np = netdev_priv(vport->netdev); 2009 1989 bool vport_is_up = test_bit(IDPF_VPORT_UP, np->state); 1990 + struct idpf_q_vec_rsrc *rsrc = &vport->dflt_qv_rsrc; 2010 1991 struct idpf_adapter *adapter = vport->adapter; 1992 + struct idpf_vport_config *vport_config; 1993 + struct idpf_q_vec_rsrc *new_rsrc; 1994 + u32 vport_id = vport->vport_id; 2011 1995 struct idpf_vport *new_vport; 2012 - int err; 1996 + int err, tmp_err = 0; 2013 1997 2014 1998 /* If the system is low on memory, we can end up in bad state if we 2015 1999 * free all the memory for queue resources and try to allocate them ··· 2038 2014 */ 2039 2015 memcpy(new_vport, vport, offsetof(struct idpf_vport, link_up)); 2040 2016 2017 + new_rsrc = &new_vport->dflt_qv_rsrc; 2018 + 2041 2019 /* Adjust resource parameters prior to reallocating resources */ 2042 2020 switch (reset_cause) { 2043 2021 case IDPF_SR_Q_CHANGE: 2044 - err = idpf_vport_adjust_qs(new_vport); 2022 + err = idpf_vport_adjust_qs(new_vport, new_rsrc); 2045 2023 if (err) 2046 2024 goto free_vport; 2047 2025 break; 2048 2026 case IDPF_SR_Q_DESC_CHANGE: 2049 2027 /* Update queue parameters before allocating resources */ 2050 - idpf_vport_calc_num_q_desc(new_vport); 2028 + idpf_vport_calc_num_q_desc(new_vport, new_rsrc); 2051 2029 break; 2052 2030 case IDPF_SR_MTU_CHANGE: 2053 2031 idpf_idc_vdev_mtu_event(vport->vdev_info, ··· 2063 2037 goto free_vport; 2064 2038 } 2065 2039 2040 + vport_config = adapter->vport_config[vport->idx]; 2041 + 2066 2042 if (!vport_is_up) { 2067 - idpf_send_delete_queues_msg(vport); 2043 + idpf_send_delete_queues_msg(adapter, &vport_config->qid_reg_info, 2044 + vport_id); 2068 2045 } else { 2069 2046 set_bit(IDPF_VPORT_DEL_QUEUES, vport->flags); 2070 2047 idpf_vport_stop(vport, false); 2071 2048 } 2072 2049 2073 - /* We're passing in vport here because we need its wait_queue 2074 - * to send a message and it should be getting all the vport 2075 - * config data out of the adapter but we need to be careful not 2076 - * to add code to add_queues to change the vport config within 2077 - * vport itself as it will be wiped with a memcpy later. 2078 - */ 2079 - err = idpf_send_add_queues_msg(vport, new_vport->num_txq, 2080 - new_vport->num_complq, 2081 - new_vport->num_rxq, 2082 - new_vport->num_bufq); 2050 + err = idpf_send_add_queues_msg(adapter, vport_config, new_rsrc, 2051 + vport_id); 2083 2052 if (err) 2084 2053 goto err_reset; 2085 2054 2086 - /* Same comment as above regarding avoiding copying the wait_queues and 2087 - * mutexes applies here. We do not want to mess with those if possible. 2055 + /* Avoid copying the wait_queues and mutexes. We do not want to mess 2056 + * with those if possible. 2088 2057 */ 2089 2058 memcpy(vport, new_vport, offsetof(struct idpf_vport, link_up)); 2090 2059 2091 2060 if (reset_cause == IDPF_SR_Q_CHANGE) 2092 - idpf_vport_alloc_vec_indexes(vport); 2061 + idpf_vport_alloc_vec_indexes(vport, &vport->dflt_qv_rsrc); 2093 2062 2094 2063 err = idpf_set_real_num_queues(vport); 2095 2064 if (err) 2096 2065 goto err_open; 2097 2066 2098 2067 if (reset_cause == IDPF_SR_Q_CHANGE && 2099 - !netif_is_rxfh_configured(vport->netdev)) 2100 - idpf_fill_dflt_rss_lut(vport); 2068 + !netif_is_rxfh_configured(vport->netdev)) { 2069 + struct idpf_rss_data *rss_data; 2070 + 2071 + rss_data = &vport_config->user_config.rss_data; 2072 + idpf_fill_dflt_rss_lut(vport, rss_data); 2073 + } 2101 2074 2102 2075 if (vport_is_up) 2103 2076 err = idpf_vport_open(vport, false); ··· 2104 2079 goto free_vport; 2105 2080 2106 2081 err_reset: 2107 - idpf_send_add_queues_msg(vport, vport->num_txq, vport->num_complq, 2108 - vport->num_rxq, vport->num_bufq); 2082 + tmp_err = idpf_send_add_queues_msg(adapter, vport_config, rsrc, 2083 + vport_id); 2109 2084 2110 2085 err_open: 2111 - if (vport_is_up) 2086 + if (!tmp_err && vport_is_up) 2112 2087 idpf_vport_open(vport, false); 2113 2088 2114 2089 free_vport: ··· 2274 2249 * the HW when the interface is brought up. 2275 2250 */ 2276 2251 if (test_bit(IDPF_VPORT_UP, np->state)) { 2277 - err = idpf_config_rss(vport); 2252 + struct idpf_vport_config *vport_config; 2253 + struct idpf_rss_data *rss_data; 2254 + 2255 + vport_config = adapter->vport_config[vport->idx]; 2256 + rss_data = &vport_config->user_config.rss_data; 2257 + err = idpf_config_rss(vport, rss_data); 2278 2258 if (err) 2279 2259 goto unlock_mutex; 2280 2260 } ··· 2293 2263 } 2294 2264 2295 2265 if (changed & NETIF_F_LOOPBACK) { 2266 + bool loopback_ena; 2267 + 2296 2268 netdev->features ^= NETIF_F_LOOPBACK; 2297 - err = idpf_send_ena_dis_loopback_msg(vport); 2269 + loopback_ena = idpf_is_feature_ena(vport, NETIF_F_LOOPBACK); 2270 + 2271 + err = idpf_send_ena_dis_loopback_msg(adapter, vport->vport_id, 2272 + loopback_ena); 2298 2273 } 2299 2274 2300 2275 unlock_mutex:
+10 -7
drivers/net/ethernet/intel/idpf/idpf_ptp.c
··· 384 384 WRITE_ONCE(adapter->ptp->cached_phc_jiffies, jiffies); 385 385 386 386 idpf_for_each_vport(adapter, vport) { 387 + struct idpf_q_vec_rsrc *rsrc; 387 388 bool split; 388 389 389 - if (!vport || !vport->rxq_grps) 390 + if (!vport || !vport->dflt_qv_rsrc.rxq_grps) 390 391 continue; 391 392 392 - split = idpf_is_queue_model_split(vport->rxq_model); 393 + rsrc = &vport->dflt_qv_rsrc; 394 + split = idpf_is_queue_model_split(rsrc->rxq_model); 393 395 394 - for (u16 i = 0; i < vport->num_rxq_grp; i++) { 395 - struct idpf_rxq_group *grp = &vport->rxq_grps[i]; 396 + for (u16 i = 0; i < rsrc->num_rxq_grp; i++) { 397 + struct idpf_rxq_group *grp = &rsrc->rxq_grps[i]; 396 398 397 399 idpf_ptp_update_phctime_rxq_grp(grp, split, systime); 398 400 } ··· 683 681 */ 684 682 static void idpf_ptp_set_rx_tstamp(struct idpf_vport *vport, int rx_filter) 685 683 { 684 + struct idpf_q_vec_rsrc *rsrc = &vport->dflt_qv_rsrc; 686 685 bool enable = true, splitq; 687 686 688 - splitq = idpf_is_queue_model_split(vport->rxq_model); 687 + splitq = idpf_is_queue_model_split(rsrc->rxq_model); 689 688 690 689 if (rx_filter == HWTSTAMP_FILTER_NONE) { 691 690 enable = false; ··· 695 692 vport->tstamp_config.rx_filter = HWTSTAMP_FILTER_ALL; 696 693 } 697 694 698 - for (u16 i = 0; i < vport->num_rxq_grp; i++) { 699 - struct idpf_rxq_group *grp = &vport->rxq_grps[i]; 695 + for (u16 i = 0; i < rsrc->num_rxq_grp; i++) { 696 + struct idpf_rxq_group *grp = &rsrc->rxq_grps[i]; 700 697 struct idpf_rx_queue *rx_queue; 701 698 u16 j, num_rxq; 702 699
+368 -346
drivers/net/ethernet/intel/idpf/idpf_txrx.c
··· 148 148 149 149 /** 150 150 * idpf_tx_desc_rel_all - Free Tx Resources for All Queues 151 - * @vport: virtual port structure 151 + * @rsrc: pointer to queue and vector resources 152 152 * 153 153 * Free all transmit software resources 154 154 */ 155 - static void idpf_tx_desc_rel_all(struct idpf_vport *vport) 155 + static void idpf_tx_desc_rel_all(struct idpf_q_vec_rsrc *rsrc) 156 156 { 157 - int i, j; 158 - 159 - if (!vport->txq_grps) 157 + if (!rsrc->txq_grps) 160 158 return; 161 159 162 - for (i = 0; i < vport->num_txq_grp; i++) { 163 - struct idpf_txq_group *txq_grp = &vport->txq_grps[i]; 160 + for (unsigned int i = 0; i < rsrc->num_txq_grp; i++) { 161 + struct idpf_txq_group *txq_grp = &rsrc->txq_grps[i]; 164 162 165 - for (j = 0; j < txq_grp->num_txq; j++) 163 + for (unsigned int j = 0; j < txq_grp->num_txq; j++) 166 164 idpf_tx_desc_rel(txq_grp->txqs[j]); 167 165 168 - if (idpf_is_queue_model_split(vport->txq_model)) 166 + if (idpf_is_queue_model_split(rsrc->txq_model)) 169 167 idpf_compl_desc_rel(txq_grp->complq); 170 168 } 171 169 } ··· 263 265 264 266 /** 265 267 * idpf_compl_desc_alloc - allocate completion descriptors 266 - * @vport: vport to allocate resources for 268 + * @vport: virtual port private structure 267 269 * @complq: completion queue to set up 268 270 * 269 271 * Return: 0 on success, -errno on failure. ··· 296 298 /** 297 299 * idpf_tx_desc_alloc_all - allocate all queues Tx resources 298 300 * @vport: virtual port private structure 301 + * @rsrc: pointer to queue and vector resources 299 302 * 300 303 * Return: 0 on success, negative on failure 301 304 */ 302 - static int idpf_tx_desc_alloc_all(struct idpf_vport *vport) 305 + static int idpf_tx_desc_alloc_all(struct idpf_vport *vport, 306 + struct idpf_q_vec_rsrc *rsrc) 303 307 { 304 308 int err = 0; 305 - int i, j; 306 309 307 310 /* Setup buffer queues. In single queue model buffer queues and 308 311 * completion queues will be same 309 312 */ 310 - for (i = 0; i < vport->num_txq_grp; i++) { 311 - for (j = 0; j < vport->txq_grps[i].num_txq; j++) { 312 - struct idpf_tx_queue *txq = vport->txq_grps[i].txqs[j]; 313 + for (unsigned int i = 0; i < rsrc->num_txq_grp; i++) { 314 + for (unsigned int j = 0; j < rsrc->txq_grps[i].num_txq; j++) { 315 + struct idpf_tx_queue *txq = rsrc->txq_grps[i].txqs[j]; 313 316 314 317 err = idpf_tx_desc_alloc(vport, txq); 315 318 if (err) { ··· 321 322 } 322 323 } 323 324 324 - if (!idpf_is_queue_model_split(vport->txq_model)) 325 + if (!idpf_is_queue_model_split(rsrc->txq_model)) 325 326 continue; 326 327 327 328 /* Setup completion queues */ 328 - err = idpf_compl_desc_alloc(vport, vport->txq_grps[i].complq); 329 + err = idpf_compl_desc_alloc(vport, rsrc->txq_grps[i].complq); 329 330 if (err) { 330 331 pci_err(vport->adapter->pdev, 331 332 "Allocation for Tx Completion Queue %u failed\n", ··· 336 337 337 338 err_out: 338 339 if (err) 339 - idpf_tx_desc_rel_all(vport); 340 + idpf_tx_desc_rel_all(rsrc); 340 341 341 342 return err; 342 343 } ··· 489 490 /** 490 491 * idpf_rx_desc_rel_all - Free Rx Resources for All Queues 491 492 * @vport: virtual port structure 493 + * @rsrc: pointer to queue and vector resources 492 494 * 493 495 * Free all rx queues resources 494 496 */ 495 - static void idpf_rx_desc_rel_all(struct idpf_vport *vport) 497 + static void idpf_rx_desc_rel_all(struct idpf_q_vec_rsrc *rsrc) 496 498 { 497 - struct device *dev = &vport->adapter->pdev->dev; 499 + struct device *dev = rsrc->dev; 498 500 struct idpf_rxq_group *rx_qgrp; 499 501 u16 num_rxq; 500 - int i, j; 501 502 502 - if (!vport->rxq_grps) 503 + if (!rsrc->rxq_grps) 503 504 return; 504 505 505 - for (i = 0; i < vport->num_rxq_grp; i++) { 506 - rx_qgrp = &vport->rxq_grps[i]; 506 + for (unsigned int i = 0; i < rsrc->num_rxq_grp; i++) { 507 + rx_qgrp = &rsrc->rxq_grps[i]; 507 508 508 - if (!idpf_is_queue_model_split(vport->rxq_model)) { 509 - for (j = 0; j < rx_qgrp->singleq.num_rxq; j++) 509 + if (!idpf_is_queue_model_split(rsrc->rxq_model)) { 510 + for (unsigned int j = 0; j < rx_qgrp->singleq.num_rxq; j++) 510 511 idpf_rx_desc_rel(rx_qgrp->singleq.rxqs[j], dev, 511 512 VIRTCHNL2_QUEUE_MODEL_SINGLE); 512 513 continue; 513 514 } 514 515 515 516 num_rxq = rx_qgrp->splitq.num_rxq_sets; 516 - for (j = 0; j < num_rxq; j++) 517 + for (unsigned int j = 0; j < num_rxq; j++) 517 518 idpf_rx_desc_rel(&rx_qgrp->splitq.rxq_sets[j]->rxq, 518 519 dev, VIRTCHNL2_QUEUE_MODEL_SPLIT); 519 520 520 521 if (!rx_qgrp->splitq.bufq_sets) 521 522 continue; 522 523 523 - for (j = 0; j < vport->num_bufqs_per_qgrp; j++) { 524 + for (unsigned int j = 0; j < rsrc->num_bufqs_per_qgrp; j++) { 524 525 struct idpf_bufq_set *bufq_set = 525 526 &rx_qgrp->splitq.bufq_sets[j]; 526 527 ··· 780 781 781 782 /** 782 783 * idpf_rx_bufs_init_all - Initialize all RX bufs 783 - * @vport: virtual port struct 784 + * @vport: pointer to vport struct 785 + * @rsrc: pointer to queue and vector resources 784 786 * 785 787 * Return: 0 on success, negative on failure 786 788 */ 787 - int idpf_rx_bufs_init_all(struct idpf_vport *vport) 789 + int idpf_rx_bufs_init_all(struct idpf_vport *vport, 790 + struct idpf_q_vec_rsrc *rsrc) 788 791 { 789 - bool split = idpf_is_queue_model_split(vport->rxq_model); 790 - int i, j, err; 792 + bool split = idpf_is_queue_model_split(rsrc->rxq_model); 793 + int err; 791 794 792 - idpf_xdp_copy_prog_to_rqs(vport, vport->xdp_prog); 795 + idpf_xdp_copy_prog_to_rqs(rsrc, vport->xdp_prog); 793 796 794 - for (i = 0; i < vport->num_rxq_grp; i++) { 795 - struct idpf_rxq_group *rx_qgrp = &vport->rxq_grps[i]; 797 + for (unsigned int i = 0; i < rsrc->num_rxq_grp; i++) { 798 + struct idpf_rxq_group *rx_qgrp = &rsrc->rxq_grps[i]; 796 799 u32 truesize = 0; 797 800 798 801 /* Allocate bufs for the rxq itself in singleq */ 799 802 if (!split) { 800 803 int num_rxq = rx_qgrp->singleq.num_rxq; 801 804 802 - for (j = 0; j < num_rxq; j++) { 805 + for (unsigned int j = 0; j < num_rxq; j++) { 803 806 struct idpf_rx_queue *q; 804 807 805 808 q = rx_qgrp->singleq.rxqs[j]; ··· 814 813 } 815 814 816 815 /* Otherwise, allocate bufs for the buffer queues */ 817 - for (j = 0; j < vport->num_bufqs_per_qgrp; j++) { 816 + for (unsigned int j = 0; j < rsrc->num_bufqs_per_qgrp; j++) { 818 817 enum libeth_fqe_type type; 819 818 struct idpf_buf_queue *q; 820 819 ··· 900 899 /** 901 900 * idpf_rx_desc_alloc_all - allocate all RX queues resources 902 901 * @vport: virtual port structure 902 + * @rsrc: pointer to queue and vector resources 903 903 * 904 904 * Return: 0 on success, negative on failure 905 905 */ 906 - static int idpf_rx_desc_alloc_all(struct idpf_vport *vport) 906 + static int idpf_rx_desc_alloc_all(struct idpf_vport *vport, 907 + struct idpf_q_vec_rsrc *rsrc) 907 908 { 908 909 struct idpf_rxq_group *rx_qgrp; 909 - int i, j, err; 910 910 u16 num_rxq; 911 + int err; 911 912 912 - for (i = 0; i < vport->num_rxq_grp; i++) { 913 - rx_qgrp = &vport->rxq_grps[i]; 914 - if (idpf_is_queue_model_split(vport->rxq_model)) 913 + for (unsigned int i = 0; i < rsrc->num_rxq_grp; i++) { 914 + rx_qgrp = &rsrc->rxq_grps[i]; 915 + if (idpf_is_queue_model_split(rsrc->rxq_model)) 915 916 num_rxq = rx_qgrp->splitq.num_rxq_sets; 916 917 else 917 918 num_rxq = rx_qgrp->singleq.num_rxq; 918 919 919 - for (j = 0; j < num_rxq; j++) { 920 + for (unsigned int j = 0; j < num_rxq; j++) { 920 921 struct idpf_rx_queue *q; 921 922 922 - if (idpf_is_queue_model_split(vport->rxq_model)) 923 + if (idpf_is_queue_model_split(rsrc->rxq_model)) 923 924 q = &rx_qgrp->splitq.rxq_sets[j]->rxq; 924 925 else 925 926 q = rx_qgrp->singleq.rxqs[j]; ··· 935 932 } 936 933 } 937 934 938 - if (!idpf_is_queue_model_split(vport->rxq_model)) 935 + if (!idpf_is_queue_model_split(rsrc->rxq_model)) 939 936 continue; 940 937 941 - for (j = 0; j < vport->num_bufqs_per_qgrp; j++) { 938 + for (unsigned int j = 0; j < rsrc->num_bufqs_per_qgrp; j++) { 942 939 struct idpf_buf_queue *q; 943 940 944 941 q = &rx_qgrp->splitq.bufq_sets[j].bufq; ··· 956 953 return 0; 957 954 958 955 err_out: 959 - idpf_rx_desc_rel_all(vport); 956 + idpf_rx_desc_rel_all(rsrc); 960 957 961 958 return err; 962 959 } 963 960 964 - static int idpf_init_queue_set(const struct idpf_queue_set *qs) 961 + static int idpf_init_queue_set(const struct idpf_vport *vport, 962 + const struct idpf_queue_set *qs) 965 963 { 966 - const struct idpf_vport *vport = qs->vport; 967 964 bool splitq; 968 965 int err; 969 966 970 - splitq = idpf_is_queue_model_split(vport->rxq_model); 967 + splitq = idpf_is_queue_model_split(qs->qv_rsrc->rxq_model); 971 968 972 969 for (u32 i = 0; i < qs->num; i++) { 973 970 const struct idpf_queue_ptr *q = &qs->qs[i]; ··· 1037 1034 1038 1035 static void idpf_clean_queue_set(const struct idpf_queue_set *qs) 1039 1036 { 1040 - const struct idpf_vport *vport = qs->vport; 1041 - struct device *dev = vport->netdev->dev.parent; 1037 + const struct idpf_q_vec_rsrc *rsrc = qs->qv_rsrc; 1042 1038 1043 1039 for (u32 i = 0; i < qs->num; i++) { 1044 1040 const struct idpf_queue_ptr *q = &qs->qs[i]; 1045 1041 1046 1042 switch (q->type) { 1047 1043 case VIRTCHNL2_QUEUE_TYPE_RX: 1048 - idpf_xdp_rxq_info_deinit(q->rxq, vport->rxq_model); 1049 - idpf_rx_desc_rel(q->rxq, dev, vport->rxq_model); 1044 + idpf_xdp_rxq_info_deinit(q->rxq, rsrc->rxq_model); 1045 + idpf_rx_desc_rel(q->rxq, rsrc->dev, rsrc->rxq_model); 1050 1046 break; 1051 1047 case VIRTCHNL2_QUEUE_TYPE_RX_BUFFER: 1052 - idpf_rx_desc_rel_bufq(q->bufq, dev); 1048 + idpf_rx_desc_rel_bufq(q->bufq, rsrc->dev); 1053 1049 break; 1054 1050 case VIRTCHNL2_QUEUE_TYPE_TX: 1055 1051 idpf_tx_desc_rel(q->txq); ··· 1115 1113 static struct idpf_queue_set * 1116 1114 idpf_vector_to_queue_set(struct idpf_q_vector *qv) 1117 1115 { 1118 - bool xdp = qv->vport->xdp_txq_offset && !qv->num_xsksq; 1116 + u32 xdp_txq_offset = qv->vport->dflt_qv_rsrc.xdp_txq_offset; 1117 + bool xdp = xdp_txq_offset && !qv->num_xsksq; 1119 1118 struct idpf_vport *vport = qv->vport; 1120 1119 struct idpf_queue_set *qs; 1121 1120 u32 num; ··· 1126 1123 if (!num) 1127 1124 return NULL; 1128 1125 1129 - qs = idpf_alloc_queue_set(vport, num); 1126 + qs = idpf_alloc_queue_set(vport->adapter, &vport->dflt_qv_rsrc, 1127 + vport->vport_id, num); 1130 1128 if (!qs) 1131 1129 return NULL; 1132 1130 ··· 1153 1149 qs->qs[num++].complq = qv->complq[i]; 1154 1150 } 1155 1151 1156 - if (!vport->xdp_txq_offset) 1152 + if (!xdp_txq_offset) 1157 1153 goto finalize; 1158 1154 1159 1155 if (xdp) { 1160 1156 for (u32 i = 0; i < qv->num_rxq; i++) { 1161 - u32 idx = vport->xdp_txq_offset + qv->rx[i]->idx; 1157 + u32 idx = xdp_txq_offset + qv->rx[i]->idx; 1162 1158 1163 1159 qs->qs[num].type = VIRTCHNL2_QUEUE_TYPE_TX; 1164 1160 qs->qs[num++].txq = vport->txqs[idx]; ··· 1185 1181 return qs; 1186 1182 } 1187 1183 1188 - static int idpf_qp_enable(const struct idpf_queue_set *qs, u32 qid) 1184 + static int idpf_qp_enable(const struct idpf_vport *vport, 1185 + const struct idpf_queue_set *qs, u32 qid) 1189 1186 { 1190 - struct idpf_vport *vport = qs->vport; 1187 + const struct idpf_q_vec_rsrc *rsrc = &vport->dflt_qv_rsrc; 1191 1188 struct idpf_q_vector *q_vector; 1192 1189 int err; 1193 1190 1194 1191 q_vector = idpf_find_rxq_vec(vport, qid); 1195 1192 1196 - err = idpf_init_queue_set(qs); 1193 + err = idpf_init_queue_set(vport, qs); 1197 1194 if (err) { 1198 1195 netdev_err(vport->netdev, "Could not initialize queues in pair %u: %pe\n", 1199 1196 qid, ERR_PTR(err)); 1200 1197 return err; 1201 1198 } 1202 1199 1203 - if (!vport->xdp_txq_offset) 1200 + if (!rsrc->xdp_txq_offset) 1204 1201 goto config; 1205 1202 1206 - q_vector->xsksq = kcalloc(DIV_ROUND_UP(vport->num_rxq_grp, 1207 - vport->num_q_vectors), 1203 + q_vector->xsksq = kcalloc(DIV_ROUND_UP(rsrc->num_rxq_grp, 1204 + rsrc->num_q_vectors), 1208 1205 sizeof(*q_vector->xsksq), GFP_KERNEL); 1209 1206 if (!q_vector->xsksq) 1210 1207 return -ENOMEM; ··· 1248 1243 return 0; 1249 1244 } 1250 1245 1251 - static int idpf_qp_disable(const struct idpf_queue_set *qs, u32 qid) 1246 + static int idpf_qp_disable(const struct idpf_vport *vport, 1247 + const struct idpf_queue_set *qs, u32 qid) 1252 1248 { 1253 - struct idpf_vport *vport = qs->vport; 1254 1249 struct idpf_q_vector *q_vector; 1255 1250 int err; 1256 1251 ··· 1295 1290 if (!qs) 1296 1291 return -ENOMEM; 1297 1292 1298 - return en ? idpf_qp_enable(qs, qid) : idpf_qp_disable(qs, qid); 1293 + return en ? idpf_qp_enable(vport, qs, qid) : 1294 + idpf_qp_disable(vport, qs, qid); 1299 1295 } 1300 1296 1301 1297 /** 1302 1298 * idpf_txq_group_rel - Release all resources for txq groups 1303 - * @vport: vport to release txq groups on 1299 + * @rsrc: pointer to queue and vector resources 1304 1300 */ 1305 - static void idpf_txq_group_rel(struct idpf_vport *vport) 1301 + static void idpf_txq_group_rel(struct idpf_q_vec_rsrc *rsrc) 1306 1302 { 1307 - bool split, flow_sch_en; 1308 - int i, j; 1303 + bool split; 1309 1304 1310 - if (!vport->txq_grps) 1305 + if (!rsrc->txq_grps) 1311 1306 return; 1312 1307 1313 - split = idpf_is_queue_model_split(vport->txq_model); 1314 - flow_sch_en = !idpf_is_cap_ena(vport->adapter, IDPF_OTHER_CAPS, 1315 - VIRTCHNL2_CAP_SPLITQ_QSCHED); 1308 + split = idpf_is_queue_model_split(rsrc->txq_model); 1316 1309 1317 - for (i = 0; i < vport->num_txq_grp; i++) { 1318 - struct idpf_txq_group *txq_grp = &vport->txq_grps[i]; 1310 + for (unsigned int i = 0; i < rsrc->num_txq_grp; i++) { 1311 + struct idpf_txq_group *txq_grp = &rsrc->txq_grps[i]; 1319 1312 1320 - for (j = 0; j < txq_grp->num_txq; j++) { 1321 - if (flow_sch_en) { 1313 + for (unsigned int j = 0; j < txq_grp->num_txq; j++) { 1314 + if (idpf_queue_has(FLOW_SCH_EN, txq_grp->txqs[j])) { 1322 1315 kfree(txq_grp->txqs[j]->refillq); 1323 1316 txq_grp->txqs[j]->refillq = NULL; 1324 1317 } ··· 1331 1328 kfree(txq_grp->complq); 1332 1329 txq_grp->complq = NULL; 1333 1330 } 1334 - kfree(vport->txq_grps); 1335 - vport->txq_grps = NULL; 1331 + kfree(rsrc->txq_grps); 1332 + rsrc->txq_grps = NULL; 1336 1333 } 1337 1334 1338 1335 /** ··· 1341 1338 */ 1342 1339 static void idpf_rxq_sw_queue_rel(struct idpf_rxq_group *rx_qgrp) 1343 1340 { 1344 - int i, j; 1345 - 1346 - for (i = 0; i < rx_qgrp->vport->num_bufqs_per_qgrp; i++) { 1341 + for (unsigned int i = 0; i < rx_qgrp->splitq.num_bufq_sets; i++) { 1347 1342 struct idpf_bufq_set *bufq_set = &rx_qgrp->splitq.bufq_sets[i]; 1348 1343 1349 - for (j = 0; j < bufq_set->num_refillqs; j++) { 1344 + for (unsigned int j = 0; j < bufq_set->num_refillqs; j++) { 1350 1345 kfree(bufq_set->refillqs[j].ring); 1351 1346 bufq_set->refillqs[j].ring = NULL; 1352 1347 } ··· 1355 1354 1356 1355 /** 1357 1356 * idpf_rxq_group_rel - Release all resources for rxq groups 1358 - * @vport: vport to release rxq groups on 1357 + * @rsrc: pointer to queue and vector resources 1359 1358 */ 1360 - static void idpf_rxq_group_rel(struct idpf_vport *vport) 1359 + static void idpf_rxq_group_rel(struct idpf_q_vec_rsrc *rsrc) 1361 1360 { 1362 - int i; 1363 - 1364 - if (!vport->rxq_grps) 1361 + if (!rsrc->rxq_grps) 1365 1362 return; 1366 1363 1367 - for (i = 0; i < vport->num_rxq_grp; i++) { 1368 - struct idpf_rxq_group *rx_qgrp = &vport->rxq_grps[i]; 1364 + for (unsigned int i = 0; i < rsrc->num_rxq_grp; i++) { 1365 + struct idpf_rxq_group *rx_qgrp = &rsrc->rxq_grps[i]; 1369 1366 u16 num_rxq; 1370 - int j; 1371 1367 1372 - if (idpf_is_queue_model_split(vport->rxq_model)) { 1368 + if (idpf_is_queue_model_split(rsrc->rxq_model)) { 1373 1369 num_rxq = rx_qgrp->splitq.num_rxq_sets; 1374 - for (j = 0; j < num_rxq; j++) { 1370 + for (unsigned int j = 0; j < num_rxq; j++) { 1375 1371 kfree(rx_qgrp->splitq.rxq_sets[j]); 1376 1372 rx_qgrp->splitq.rxq_sets[j] = NULL; 1377 1373 } ··· 1378 1380 rx_qgrp->splitq.bufq_sets = NULL; 1379 1381 } else { 1380 1382 num_rxq = rx_qgrp->singleq.num_rxq; 1381 - for (j = 0; j < num_rxq; j++) { 1383 + for (unsigned int j = 0; j < num_rxq; j++) { 1382 1384 kfree(rx_qgrp->singleq.rxqs[j]); 1383 1385 rx_qgrp->singleq.rxqs[j] = NULL; 1384 1386 } 1385 1387 } 1386 1388 } 1387 - kfree(vport->rxq_grps); 1388 - vport->rxq_grps = NULL; 1389 + kfree(rsrc->rxq_grps); 1390 + rsrc->rxq_grps = NULL; 1389 1391 } 1390 1392 1391 1393 /** 1392 1394 * idpf_vport_queue_grp_rel_all - Release all queue groups 1393 1395 * @vport: vport to release queue groups for 1396 + * @rsrc: pointer to queue and vector resources 1394 1397 */ 1395 - static void idpf_vport_queue_grp_rel_all(struct idpf_vport *vport) 1398 + static void idpf_vport_queue_grp_rel_all(struct idpf_q_vec_rsrc *rsrc) 1396 1399 { 1397 - idpf_txq_group_rel(vport); 1398 - idpf_rxq_group_rel(vport); 1400 + idpf_txq_group_rel(rsrc); 1401 + idpf_rxq_group_rel(rsrc); 1399 1402 } 1400 1403 1401 1404 /** 1402 1405 * idpf_vport_queues_rel - Free memory for all queues 1403 1406 * @vport: virtual port 1407 + * @rsrc: pointer to queue and vector resources 1404 1408 * 1405 1409 * Free the memory allocated for queues associated to a vport 1406 1410 */ 1407 - void idpf_vport_queues_rel(struct idpf_vport *vport) 1411 + void idpf_vport_queues_rel(struct idpf_vport *vport, 1412 + struct idpf_q_vec_rsrc *rsrc) 1408 1413 { 1409 - idpf_xdp_copy_prog_to_rqs(vport, NULL); 1414 + idpf_xdp_copy_prog_to_rqs(rsrc, NULL); 1410 1415 1411 - idpf_tx_desc_rel_all(vport); 1412 - idpf_rx_desc_rel_all(vport); 1416 + idpf_tx_desc_rel_all(rsrc); 1417 + idpf_rx_desc_rel_all(rsrc); 1413 1418 1414 1419 idpf_xdpsqs_put(vport); 1415 - idpf_vport_queue_grp_rel_all(vport); 1420 + idpf_vport_queue_grp_rel_all(rsrc); 1416 1421 1417 1422 kfree(vport->txqs); 1418 1423 vport->txqs = NULL; ··· 1424 1423 /** 1425 1424 * idpf_vport_init_fast_path_txqs - Initialize fast path txq array 1426 1425 * @vport: vport to init txqs on 1426 + * @rsrc: pointer to queue and vector resources 1427 1427 * 1428 1428 * We get a queue index from skb->queue_mapping and we need a fast way to 1429 1429 * dereference the queue from queue groups. This allows us to quickly pull a ··· 1432 1430 * 1433 1431 * Return: 0 on success, negative on failure 1434 1432 */ 1435 - static int idpf_vport_init_fast_path_txqs(struct idpf_vport *vport) 1433 + static int idpf_vport_init_fast_path_txqs(struct idpf_vport *vport, 1434 + struct idpf_q_vec_rsrc *rsrc) 1436 1435 { 1437 1436 struct idpf_ptp_vport_tx_tstamp_caps *caps = vport->tx_tstamp_caps; 1438 1437 struct work_struct *tstamp_task = &vport->tstamp_task; 1439 - int i, j, k = 0; 1438 + int k = 0; 1440 1439 1441 - vport->txqs = kcalloc(vport->num_txq, sizeof(*vport->txqs), 1440 + vport->txqs = kcalloc(rsrc->num_txq, sizeof(*vport->txqs), 1442 1441 GFP_KERNEL); 1443 - 1444 1442 if (!vport->txqs) 1445 1443 return -ENOMEM; 1446 1444 1447 - for (i = 0; i < vport->num_txq_grp; i++) { 1448 - struct idpf_txq_group *tx_grp = &vport->txq_grps[i]; 1445 + vport->num_txq = rsrc->num_txq; 1446 + for (unsigned int i = 0; i < rsrc->num_txq_grp; i++) { 1447 + struct idpf_txq_group *tx_grp = &rsrc->txq_grps[i]; 1449 1448 1450 - for (j = 0; j < tx_grp->num_txq; j++, k++) { 1449 + for (unsigned int j = 0; j < tx_grp->num_txq; j++, k++) { 1451 1450 vport->txqs[k] = tx_grp->txqs[j]; 1452 1451 vport->txqs[k]->idx = k; 1453 1452 ··· 1467 1464 * idpf_vport_init_num_qs - Initialize number of queues 1468 1465 * @vport: vport to initialize queues 1469 1466 * @vport_msg: data to be filled into vport 1467 + * @rsrc: pointer to queue and vector resources 1470 1468 */ 1471 1469 void idpf_vport_init_num_qs(struct idpf_vport *vport, 1472 - struct virtchnl2_create_vport *vport_msg) 1470 + struct virtchnl2_create_vport *vport_msg, 1471 + struct idpf_q_vec_rsrc *rsrc) 1473 1472 { 1474 1473 struct idpf_vport_user_config_data *config_data; 1475 1474 u16 idx = vport->idx; 1476 1475 1477 1476 config_data = &vport->adapter->vport_config[idx]->user_config; 1478 - vport->num_txq = le16_to_cpu(vport_msg->num_tx_q); 1479 - vport->num_rxq = le16_to_cpu(vport_msg->num_rx_q); 1477 + rsrc->num_txq = le16_to_cpu(vport_msg->num_tx_q); 1478 + rsrc->num_rxq = le16_to_cpu(vport_msg->num_rx_q); 1480 1479 /* number of txqs and rxqs in config data will be zeros only in the 1481 1480 * driver load path and we dont update them there after 1482 1481 */ ··· 1487 1482 config_data->num_req_rx_qs = le16_to_cpu(vport_msg->num_rx_q); 1488 1483 } 1489 1484 1490 - if (idpf_is_queue_model_split(vport->txq_model)) 1491 - vport->num_complq = le16_to_cpu(vport_msg->num_tx_complq); 1492 - if (idpf_is_queue_model_split(vport->rxq_model)) 1493 - vport->num_bufq = le16_to_cpu(vport_msg->num_rx_bufq); 1485 + if (idpf_is_queue_model_split(rsrc->txq_model)) 1486 + rsrc->num_complq = le16_to_cpu(vport_msg->num_tx_complq); 1487 + if (idpf_is_queue_model_split(rsrc->rxq_model)) 1488 + rsrc->num_bufq = le16_to_cpu(vport_msg->num_rx_bufq); 1494 1489 1495 1490 vport->xdp_prog = config_data->xdp_prog; 1496 1491 if (idpf_xdp_enabled(vport)) { 1497 - vport->xdp_txq_offset = config_data->num_req_tx_qs; 1492 + rsrc->xdp_txq_offset = config_data->num_req_tx_qs; 1498 1493 vport->num_xdp_txq = le16_to_cpu(vport_msg->num_tx_q) - 1499 - vport->xdp_txq_offset; 1494 + rsrc->xdp_txq_offset; 1500 1495 vport->xdpsq_share = libeth_xdpsq_shared(vport->num_xdp_txq); 1501 1496 } else { 1502 - vport->xdp_txq_offset = 0; 1497 + rsrc->xdp_txq_offset = 0; 1503 1498 vport->num_xdp_txq = 0; 1504 1499 vport->xdpsq_share = false; 1505 1500 } 1506 1501 1507 1502 /* Adjust number of buffer queues per Rx queue group. */ 1508 - if (!idpf_is_queue_model_split(vport->rxq_model)) { 1509 - vport->num_bufqs_per_qgrp = 0; 1503 + if (!idpf_is_queue_model_split(rsrc->rxq_model)) { 1504 + rsrc->num_bufqs_per_qgrp = 0; 1510 1505 1511 1506 return; 1512 1507 } 1513 1508 1514 - vport->num_bufqs_per_qgrp = IDPF_MAX_BUFQS_PER_RXQ_GRP; 1509 + rsrc->num_bufqs_per_qgrp = IDPF_MAX_BUFQS_PER_RXQ_GRP; 1515 1510 } 1516 1511 1517 1512 /** 1518 1513 * idpf_vport_calc_num_q_desc - Calculate number of queue groups 1519 1514 * @vport: vport to calculate q groups for 1515 + * @rsrc: pointer to queue and vector resources 1520 1516 */ 1521 - void idpf_vport_calc_num_q_desc(struct idpf_vport *vport) 1517 + void idpf_vport_calc_num_q_desc(struct idpf_vport *vport, 1518 + struct idpf_q_vec_rsrc *rsrc) 1522 1519 { 1523 1520 struct idpf_vport_user_config_data *config_data; 1524 - int num_bufqs = vport->num_bufqs_per_qgrp; 1521 + u8 num_bufqs = rsrc->num_bufqs_per_qgrp; 1525 1522 u32 num_req_txq_desc, num_req_rxq_desc; 1526 1523 u16 idx = vport->idx; 1527 - int i; 1528 1524 1529 1525 config_data = &vport->adapter->vport_config[idx]->user_config; 1530 1526 num_req_txq_desc = config_data->num_req_txq_desc; 1531 1527 num_req_rxq_desc = config_data->num_req_rxq_desc; 1532 1528 1533 - vport->complq_desc_count = 0; 1529 + rsrc->complq_desc_count = 0; 1534 1530 if (num_req_txq_desc) { 1535 - vport->txq_desc_count = num_req_txq_desc; 1536 - if (idpf_is_queue_model_split(vport->txq_model)) { 1537 - vport->complq_desc_count = num_req_txq_desc; 1538 - if (vport->complq_desc_count < IDPF_MIN_TXQ_COMPLQ_DESC) 1539 - vport->complq_desc_count = 1531 + rsrc->txq_desc_count = num_req_txq_desc; 1532 + if (idpf_is_queue_model_split(rsrc->txq_model)) { 1533 + rsrc->complq_desc_count = num_req_txq_desc; 1534 + if (rsrc->complq_desc_count < IDPF_MIN_TXQ_COMPLQ_DESC) 1535 + rsrc->complq_desc_count = 1540 1536 IDPF_MIN_TXQ_COMPLQ_DESC; 1541 1537 } 1542 1538 } else { 1543 - vport->txq_desc_count = IDPF_DFLT_TX_Q_DESC_COUNT; 1544 - if (idpf_is_queue_model_split(vport->txq_model)) 1545 - vport->complq_desc_count = 1539 + rsrc->txq_desc_count = IDPF_DFLT_TX_Q_DESC_COUNT; 1540 + if (idpf_is_queue_model_split(rsrc->txq_model)) 1541 + rsrc->complq_desc_count = 1546 1542 IDPF_DFLT_TX_COMPLQ_DESC_COUNT; 1547 1543 } 1548 1544 1549 1545 if (num_req_rxq_desc) 1550 - vport->rxq_desc_count = num_req_rxq_desc; 1546 + rsrc->rxq_desc_count = num_req_rxq_desc; 1551 1547 else 1552 - vport->rxq_desc_count = IDPF_DFLT_RX_Q_DESC_COUNT; 1548 + rsrc->rxq_desc_count = IDPF_DFLT_RX_Q_DESC_COUNT; 1553 1549 1554 - for (i = 0; i < num_bufqs; i++) { 1555 - if (!vport->bufq_desc_count[i]) 1556 - vport->bufq_desc_count[i] = 1557 - IDPF_RX_BUFQ_DESC_COUNT(vport->rxq_desc_count, 1550 + for (unsigned int i = 0; i < num_bufqs; i++) { 1551 + if (!rsrc->bufq_desc_count[i]) 1552 + rsrc->bufq_desc_count[i] = 1553 + IDPF_RX_BUFQ_DESC_COUNT(rsrc->rxq_desc_count, 1558 1554 num_bufqs); 1559 1555 } 1560 1556 } ··· 1644 1638 1645 1639 /** 1646 1640 * idpf_vport_calc_num_q_groups - Calculate number of queue groups 1647 - * @vport: vport to calculate q groups for 1641 + * @rsrc: pointer to queue and vector resources 1648 1642 */ 1649 - void idpf_vport_calc_num_q_groups(struct idpf_vport *vport) 1643 + void idpf_vport_calc_num_q_groups(struct idpf_q_vec_rsrc *rsrc) 1650 1644 { 1651 - if (idpf_is_queue_model_split(vport->txq_model)) 1652 - vport->num_txq_grp = vport->num_txq; 1645 + if (idpf_is_queue_model_split(rsrc->txq_model)) 1646 + rsrc->num_txq_grp = rsrc->num_txq; 1653 1647 else 1654 - vport->num_txq_grp = IDPF_DFLT_SINGLEQ_TX_Q_GROUPS; 1648 + rsrc->num_txq_grp = IDPF_DFLT_SINGLEQ_TX_Q_GROUPS; 1655 1649 1656 - if (idpf_is_queue_model_split(vport->rxq_model)) 1657 - vport->num_rxq_grp = vport->num_rxq; 1650 + if (idpf_is_queue_model_split(rsrc->rxq_model)) 1651 + rsrc->num_rxq_grp = rsrc->num_rxq; 1658 1652 else 1659 - vport->num_rxq_grp = IDPF_DFLT_SINGLEQ_RX_Q_GROUPS; 1653 + rsrc->num_rxq_grp = IDPF_DFLT_SINGLEQ_RX_Q_GROUPS; 1660 1654 } 1661 1655 1662 1656 /** 1663 1657 * idpf_vport_calc_numq_per_grp - Calculate number of queues per group 1664 - * @vport: vport to calculate queues for 1658 + * @rsrc: pointer to queue and vector resources 1665 1659 * @num_txq: return parameter for number of TX queues 1666 1660 * @num_rxq: return parameter for number of RX queues 1667 1661 */ 1668 - static void idpf_vport_calc_numq_per_grp(struct idpf_vport *vport, 1662 + static void idpf_vport_calc_numq_per_grp(struct idpf_q_vec_rsrc *rsrc, 1669 1663 u16 *num_txq, u16 *num_rxq) 1670 1664 { 1671 - if (idpf_is_queue_model_split(vport->txq_model)) 1665 + if (idpf_is_queue_model_split(rsrc->txq_model)) 1672 1666 *num_txq = IDPF_DFLT_SPLITQ_TXQ_PER_GROUP; 1673 1667 else 1674 - *num_txq = vport->num_txq; 1668 + *num_txq = rsrc->num_txq; 1675 1669 1676 - if (idpf_is_queue_model_split(vport->rxq_model)) 1670 + if (idpf_is_queue_model_split(rsrc->rxq_model)) 1677 1671 *num_rxq = IDPF_DFLT_SPLITQ_RXQ_PER_GROUP; 1678 1672 else 1679 - *num_rxq = vport->num_rxq; 1673 + *num_rxq = rsrc->num_rxq; 1680 1674 } 1681 1675 1682 1676 /** 1683 1677 * idpf_rxq_set_descids - set the descids supported by this queue 1684 - * @vport: virtual port data structure 1678 + * @rsrc: pointer to queue and vector resources 1685 1679 * @q: rx queue for which descids are set 1686 1680 * 1687 1681 */ 1688 - static void idpf_rxq_set_descids(const struct idpf_vport *vport, 1682 + static void idpf_rxq_set_descids(struct idpf_q_vec_rsrc *rsrc, 1689 1683 struct idpf_rx_queue *q) 1690 1684 { 1691 - if (idpf_is_queue_model_split(vport->rxq_model)) 1685 + if (idpf_is_queue_model_split(rsrc->rxq_model)) 1692 1686 return; 1693 1687 1694 - if (vport->base_rxd) 1688 + if (rsrc->base_rxd) 1695 1689 q->rxdids = VIRTCHNL2_RXDID_1_32B_BASE_M; 1696 1690 else 1697 1691 q->rxdids = VIRTCHNL2_RXDID_2_FLEX_SQ_NIC_M; ··· 1700 1694 /** 1701 1695 * idpf_txq_group_alloc - Allocate all txq group resources 1702 1696 * @vport: vport to allocate txq groups for 1697 + * @rsrc: pointer to queue and vector resources 1703 1698 * @num_txq: number of txqs to allocate for each group 1704 1699 * 1705 1700 * Return: 0 on success, negative on failure 1706 1701 */ 1707 - static int idpf_txq_group_alloc(struct idpf_vport *vport, u16 num_txq) 1702 + static int idpf_txq_group_alloc(struct idpf_vport *vport, 1703 + struct idpf_q_vec_rsrc *rsrc, 1704 + u16 num_txq) 1708 1705 { 1709 1706 bool split, flow_sch_en; 1710 - int i; 1711 1707 1712 - vport->txq_grps = kcalloc(vport->num_txq_grp, 1713 - sizeof(*vport->txq_grps), GFP_KERNEL); 1714 - if (!vport->txq_grps) 1708 + rsrc->txq_grps = kcalloc(rsrc->num_txq_grp, 1709 + sizeof(*rsrc->txq_grps), GFP_KERNEL); 1710 + if (!rsrc->txq_grps) 1715 1711 return -ENOMEM; 1716 1712 1717 - split = idpf_is_queue_model_split(vport->txq_model); 1713 + split = idpf_is_queue_model_split(rsrc->txq_model); 1718 1714 flow_sch_en = !idpf_is_cap_ena(vport->adapter, IDPF_OTHER_CAPS, 1719 1715 VIRTCHNL2_CAP_SPLITQ_QSCHED); 1720 1716 1721 - for (i = 0; i < vport->num_txq_grp; i++) { 1722 - struct idpf_txq_group *tx_qgrp = &vport->txq_grps[i]; 1717 + for (unsigned int i = 0; i < rsrc->num_txq_grp; i++) { 1718 + struct idpf_txq_group *tx_qgrp = &rsrc->txq_grps[i]; 1723 1719 struct idpf_adapter *adapter = vport->adapter; 1724 - int j; 1725 1720 1726 1721 tx_qgrp->vport = vport; 1727 1722 tx_qgrp->num_txq = num_txq; 1728 1723 1729 - for (j = 0; j < tx_qgrp->num_txq; j++) { 1724 + for (unsigned int j = 0; j < tx_qgrp->num_txq; j++) { 1730 1725 tx_qgrp->txqs[j] = kzalloc(sizeof(*tx_qgrp->txqs[j]), 1731 1726 GFP_KERNEL); 1732 1727 if (!tx_qgrp->txqs[j]) 1733 1728 goto err_alloc; 1734 1729 } 1735 1730 1736 - for (j = 0; j < tx_qgrp->num_txq; j++) { 1731 + for (unsigned int j = 0; j < tx_qgrp->num_txq; j++) { 1737 1732 struct idpf_tx_queue *q = tx_qgrp->txqs[j]; 1738 1733 1739 1734 q->dev = &adapter->pdev->dev; 1740 - q->desc_count = vport->txq_desc_count; 1735 + q->desc_count = rsrc->txq_desc_count; 1741 1736 q->tx_max_bufs = idpf_get_max_tx_bufs(adapter); 1742 1737 q->tx_min_pkt_len = idpf_get_min_tx_pkt_len(adapter); 1743 1738 q->netdev = vport->netdev; ··· 1773 1766 if (!tx_qgrp->complq) 1774 1767 goto err_alloc; 1775 1768 1776 - tx_qgrp->complq->desc_count = vport->complq_desc_count; 1769 + tx_qgrp->complq->desc_count = rsrc->complq_desc_count; 1777 1770 tx_qgrp->complq->txq_grp = tx_qgrp; 1778 1771 tx_qgrp->complq->netdev = vport->netdev; 1779 1772 tx_qgrp->complq->clean_budget = vport->compln_clean_budget; ··· 1785 1778 return 0; 1786 1779 1787 1780 err_alloc: 1788 - idpf_txq_group_rel(vport); 1781 + idpf_txq_group_rel(rsrc); 1789 1782 1790 1783 return -ENOMEM; 1791 1784 } ··· 1793 1786 /** 1794 1787 * idpf_rxq_group_alloc - Allocate all rxq group resources 1795 1788 * @vport: vport to allocate rxq groups for 1789 + * @rsrc: pointer to queue and vector resources 1796 1790 * @num_rxq: number of rxqs to allocate for each group 1797 1791 * 1798 1792 * Return: 0 on success, negative on failure 1799 1793 */ 1800 - static int idpf_rxq_group_alloc(struct idpf_vport *vport, u16 num_rxq) 1794 + static int idpf_rxq_group_alloc(struct idpf_vport *vport, 1795 + struct idpf_q_vec_rsrc *rsrc, 1796 + u16 num_rxq) 1801 1797 { 1802 - int i, k, err = 0; 1803 - bool hs; 1798 + struct idpf_adapter *adapter = vport->adapter; 1799 + bool hs, rsc; 1800 + int err = 0; 1804 1801 1805 - vport->rxq_grps = kcalloc(vport->num_rxq_grp, 1806 - sizeof(struct idpf_rxq_group), GFP_KERNEL); 1807 - if (!vport->rxq_grps) 1802 + rsrc->rxq_grps = kcalloc(rsrc->num_rxq_grp, 1803 + sizeof(struct idpf_rxq_group), GFP_KERNEL); 1804 + if (!rsrc->rxq_grps) 1808 1805 return -ENOMEM; 1809 1806 1810 1807 hs = idpf_vport_get_hsplit(vport) == ETHTOOL_TCP_DATA_SPLIT_ENABLED; 1808 + rsc = idpf_is_feature_ena(vport, NETIF_F_GRO_HW); 1811 1809 1812 - for (i = 0; i < vport->num_rxq_grp; i++) { 1813 - struct idpf_rxq_group *rx_qgrp = &vport->rxq_grps[i]; 1814 - int j; 1810 + for (unsigned int i = 0; i < rsrc->num_rxq_grp; i++) { 1811 + struct idpf_rxq_group *rx_qgrp = &rsrc->rxq_grps[i]; 1815 1812 1816 1813 rx_qgrp->vport = vport; 1817 - if (!idpf_is_queue_model_split(vport->rxq_model)) { 1814 + if (!idpf_is_queue_model_split(rsrc->rxq_model)) { 1818 1815 rx_qgrp->singleq.num_rxq = num_rxq; 1819 - for (j = 0; j < num_rxq; j++) { 1816 + for (unsigned int j = 0; j < num_rxq; j++) { 1820 1817 rx_qgrp->singleq.rxqs[j] = 1821 1818 kzalloc(sizeof(*rx_qgrp->singleq.rxqs[j]), 1822 1819 GFP_KERNEL); ··· 1833 1822 } 1834 1823 rx_qgrp->splitq.num_rxq_sets = num_rxq; 1835 1824 1836 - for (j = 0; j < num_rxq; j++) { 1825 + for (unsigned int j = 0; j < num_rxq; j++) { 1837 1826 rx_qgrp->splitq.rxq_sets[j] = 1838 1827 kzalloc(sizeof(struct idpf_rxq_set), 1839 1828 GFP_KERNEL); ··· 1843 1832 } 1844 1833 } 1845 1834 1846 - rx_qgrp->splitq.bufq_sets = kcalloc(vport->num_bufqs_per_qgrp, 1835 + rx_qgrp->splitq.bufq_sets = kcalloc(rsrc->num_bufqs_per_qgrp, 1847 1836 sizeof(struct idpf_bufq_set), 1848 1837 GFP_KERNEL); 1849 1838 if (!rx_qgrp->splitq.bufq_sets) { 1850 1839 err = -ENOMEM; 1851 1840 goto err_alloc; 1852 1841 } 1842 + rx_qgrp->splitq.num_bufq_sets = rsrc->num_bufqs_per_qgrp; 1853 1843 1854 - for (j = 0; j < vport->num_bufqs_per_qgrp; j++) { 1844 + for (unsigned int j = 0; j < rsrc->num_bufqs_per_qgrp; j++) { 1855 1845 struct idpf_bufq_set *bufq_set = 1856 1846 &rx_qgrp->splitq.bufq_sets[j]; 1857 1847 int swq_size = sizeof(struct idpf_sw_queue); 1858 1848 struct idpf_buf_queue *q; 1859 1849 1860 1850 q = &rx_qgrp->splitq.bufq_sets[j].bufq; 1861 - q->desc_count = vport->bufq_desc_count[j]; 1851 + q->desc_count = rsrc->bufq_desc_count[j]; 1862 1852 q->rx_buffer_low_watermark = IDPF_LOW_WATERMARK; 1863 1853 1864 1854 idpf_queue_assign(HSPLIT_EN, q, hs); 1855 + idpf_queue_assign(RSC_EN, q, rsc); 1865 1856 1866 1857 bufq_set->num_refillqs = num_rxq; 1867 1858 bufq_set->refillqs = kcalloc(num_rxq, swq_size, ··· 1872 1859 err = -ENOMEM; 1873 1860 goto err_alloc; 1874 1861 } 1875 - for (k = 0; k < bufq_set->num_refillqs; k++) { 1862 + for (unsigned int k = 0; k < bufq_set->num_refillqs; k++) { 1876 1863 struct idpf_sw_queue *refillq = 1877 1864 &bufq_set->refillqs[k]; 1878 1865 1879 1866 refillq->desc_count = 1880 - vport->bufq_desc_count[j]; 1867 + rsrc->bufq_desc_count[j]; 1881 1868 idpf_queue_set(GEN_CHK, refillq); 1882 1869 idpf_queue_set(RFL_GEN_CHK, refillq); 1883 1870 refillq->ring = kcalloc(refillq->desc_count, ··· 1891 1878 } 1892 1879 1893 1880 skip_splitq_rx_init: 1894 - for (j = 0; j < num_rxq; j++) { 1881 + for (unsigned int j = 0; j < num_rxq; j++) { 1895 1882 struct idpf_rx_queue *q; 1896 1883 1897 - if (!idpf_is_queue_model_split(vport->rxq_model)) { 1884 + if (!idpf_is_queue_model_split(rsrc->rxq_model)) { 1898 1885 q = rx_qgrp->singleq.rxqs[j]; 1886 + q->rx_ptype_lkup = adapter->singleq_pt_lkup; 1899 1887 goto setup_rxq; 1900 1888 } 1901 1889 q = &rx_qgrp->splitq.rxq_sets[j]->rxq; 1902 1890 rx_qgrp->splitq.rxq_sets[j]->refillq[0] = 1903 1891 &rx_qgrp->splitq.bufq_sets[0].refillqs[j]; 1904 - if (vport->num_bufqs_per_qgrp > IDPF_SINGLE_BUFQ_PER_RXQ_GRP) 1892 + if (rsrc->num_bufqs_per_qgrp > IDPF_SINGLE_BUFQ_PER_RXQ_GRP) 1905 1893 rx_qgrp->splitq.rxq_sets[j]->refillq[1] = 1906 1894 &rx_qgrp->splitq.bufq_sets[1].refillqs[j]; 1907 1895 1908 1896 idpf_queue_assign(HSPLIT_EN, q, hs); 1897 + idpf_queue_assign(RSC_EN, q, rsc); 1898 + q->rx_ptype_lkup = adapter->splitq_pt_lkup; 1909 1899 1910 1900 setup_rxq: 1911 - q->desc_count = vport->rxq_desc_count; 1912 - q->rx_ptype_lkup = vport->rx_ptype_lkup; 1901 + q->desc_count = rsrc->rxq_desc_count; 1913 1902 q->bufq_sets = rx_qgrp->splitq.bufq_sets; 1914 1903 q->idx = (i * num_rxq) + j; 1915 1904 q->rx_buffer_low_watermark = IDPF_LOW_WATERMARK; 1916 1905 q->rx_max_pkt_size = vport->netdev->mtu + 1917 1906 LIBETH_RX_LL_LEN; 1918 - idpf_rxq_set_descids(vport, q); 1907 + idpf_rxq_set_descids(rsrc, q); 1919 1908 } 1920 1909 } 1921 1910 1922 1911 err_alloc: 1923 1912 if (err) 1924 - idpf_rxq_group_rel(vport); 1913 + idpf_rxq_group_rel(rsrc); 1925 1914 1926 1915 return err; 1927 1916 } ··· 1931 1916 /** 1932 1917 * idpf_vport_queue_grp_alloc_all - Allocate all queue groups/resources 1933 1918 * @vport: vport with qgrps to allocate 1919 + * @rsrc: pointer to queue and vector resources 1934 1920 * 1935 1921 * Return: 0 on success, negative on failure 1936 1922 */ 1937 - static int idpf_vport_queue_grp_alloc_all(struct idpf_vport *vport) 1923 + static int idpf_vport_queue_grp_alloc_all(struct idpf_vport *vport, 1924 + struct idpf_q_vec_rsrc *rsrc) 1938 1925 { 1939 1926 u16 num_txq, num_rxq; 1940 1927 int err; 1941 1928 1942 - idpf_vport_calc_numq_per_grp(vport, &num_txq, &num_rxq); 1929 + idpf_vport_calc_numq_per_grp(rsrc, &num_txq, &num_rxq); 1943 1930 1944 - err = idpf_txq_group_alloc(vport, num_txq); 1931 + err = idpf_txq_group_alloc(vport, rsrc, num_txq); 1945 1932 if (err) 1946 1933 goto err_out; 1947 1934 1948 - err = idpf_rxq_group_alloc(vport, num_rxq); 1935 + err = idpf_rxq_group_alloc(vport, rsrc, num_rxq); 1949 1936 if (err) 1950 1937 goto err_out; 1951 1938 1952 1939 return 0; 1953 1940 1954 1941 err_out: 1955 - idpf_vport_queue_grp_rel_all(vport); 1942 + idpf_vport_queue_grp_rel_all(rsrc); 1956 1943 1957 1944 return err; 1958 1945 } ··· 1962 1945 /** 1963 1946 * idpf_vport_queues_alloc - Allocate memory for all queues 1964 1947 * @vport: virtual port 1948 + * @rsrc: pointer to queue and vector resources 1965 1949 * 1966 1950 * Allocate memory for queues associated with a vport. 1967 1951 * 1968 1952 * Return: 0 on success, negative on failure. 1969 1953 */ 1970 - int idpf_vport_queues_alloc(struct idpf_vport *vport) 1954 + int idpf_vport_queues_alloc(struct idpf_vport *vport, 1955 + struct idpf_q_vec_rsrc *rsrc) 1971 1956 { 1972 1957 int err; 1973 1958 1974 - err = idpf_vport_queue_grp_alloc_all(vport); 1959 + err = idpf_vport_queue_grp_alloc_all(vport, rsrc); 1975 1960 if (err) 1976 1961 goto err_out; 1977 1962 1978 - err = idpf_vport_init_fast_path_txqs(vport); 1963 + err = idpf_vport_init_fast_path_txqs(vport, rsrc); 1979 1964 if (err) 1980 1965 goto err_out; 1981 1966 ··· 1985 1966 if (err) 1986 1967 goto err_out; 1987 1968 1988 - err = idpf_tx_desc_alloc_all(vport); 1969 + err = idpf_tx_desc_alloc_all(vport, rsrc); 1989 1970 if (err) 1990 1971 goto err_out; 1991 1972 1992 - err = idpf_rx_desc_alloc_all(vport); 1973 + err = idpf_rx_desc_alloc_all(vport, rsrc); 1993 1974 if (err) 1994 1975 goto err_out; 1995 1976 1996 1977 return 0; 1997 1978 1998 1979 err_out: 1999 - idpf_vport_queues_rel(vport); 1980 + idpf_vport_queues_rel(vport, rsrc); 2000 1981 2001 1982 return err; 2002 1983 } ··· 3173 3154 return NETDEV_TX_OK; 3174 3155 } 3175 3156 3176 - if (idpf_is_queue_model_split(vport->txq_model)) 3157 + if (idpf_is_queue_model_split(vport->dflt_qv_rsrc.txq_model)) 3177 3158 return idpf_tx_splitq_frame(skb, tx_q); 3178 3159 else 3179 3160 return idpf_tx_singleq_frame(skb, tx_q); ··· 3799 3780 3800 3781 /** 3801 3782 * idpf_vport_intr_napi_del_all - Unregister napi for all q_vectors in vport 3802 - * @vport: virtual port structure 3803 - * 3783 + * @rsrc: pointer to queue and vector resources 3804 3784 */ 3805 - static void idpf_vport_intr_napi_del_all(struct idpf_vport *vport) 3785 + static void idpf_vport_intr_napi_del_all(struct idpf_q_vec_rsrc *rsrc) 3806 3786 { 3807 - u16 v_idx; 3808 - 3809 - for (v_idx = 0; v_idx < vport->num_q_vectors; v_idx++) 3810 - netif_napi_del(&vport->q_vectors[v_idx].napi); 3787 + for (u16 v_idx = 0; v_idx < rsrc->num_q_vectors; v_idx++) 3788 + netif_napi_del(&rsrc->q_vectors[v_idx].napi); 3811 3789 } 3812 3790 3813 3791 /** 3814 3792 * idpf_vport_intr_napi_dis_all - Disable NAPI for all q_vectors in the vport 3815 - * @vport: main vport structure 3793 + * @rsrc: pointer to queue and vector resources 3816 3794 */ 3817 - static void idpf_vport_intr_napi_dis_all(struct idpf_vport *vport) 3795 + static void idpf_vport_intr_napi_dis_all(struct idpf_q_vec_rsrc *rsrc) 3818 3796 { 3819 - int v_idx; 3820 - 3821 - for (v_idx = 0; v_idx < vport->num_q_vectors; v_idx++) 3822 - napi_disable(&vport->q_vectors[v_idx].napi); 3797 + for (u16 v_idx = 0; v_idx < rsrc->num_q_vectors; v_idx++) 3798 + napi_disable(&rsrc->q_vectors[v_idx].napi); 3823 3799 } 3824 3800 3825 3801 /** 3826 3802 * idpf_vport_intr_rel - Free memory allocated for interrupt vectors 3827 - * @vport: virtual port 3803 + * @rsrc: pointer to queue and vector resources 3828 3804 * 3829 3805 * Free the memory allocated for interrupt vectors associated to a vport 3830 3806 */ 3831 - void idpf_vport_intr_rel(struct idpf_vport *vport) 3807 + void idpf_vport_intr_rel(struct idpf_q_vec_rsrc *rsrc) 3832 3808 { 3833 - for (u32 v_idx = 0; v_idx < vport->num_q_vectors; v_idx++) { 3834 - struct idpf_q_vector *q_vector = &vport->q_vectors[v_idx]; 3809 + for (u16 v_idx = 0; v_idx < rsrc->num_q_vectors; v_idx++) { 3810 + struct idpf_q_vector *q_vector = &rsrc->q_vectors[v_idx]; 3835 3811 3836 3812 kfree(q_vector->xsksq); 3837 3813 q_vector->xsksq = NULL; ··· 3840 3826 q_vector->rx = NULL; 3841 3827 } 3842 3828 3843 - kfree(vport->q_vectors); 3844 - vport->q_vectors = NULL; 3829 + kfree(rsrc->q_vectors); 3830 + rsrc->q_vectors = NULL; 3845 3831 } 3846 3832 3847 3833 static void idpf_q_vector_set_napi(struct idpf_q_vector *q_vector, bool link) ··· 3861 3847 /** 3862 3848 * idpf_vport_intr_rel_irq - Free the IRQ association with the OS 3863 3849 * @vport: main vport structure 3850 + * @rsrc: pointer to queue and vector resources 3864 3851 */ 3865 - static void idpf_vport_intr_rel_irq(struct idpf_vport *vport) 3852 + static void idpf_vport_intr_rel_irq(struct idpf_vport *vport, 3853 + struct idpf_q_vec_rsrc *rsrc) 3866 3854 { 3867 3855 struct idpf_adapter *adapter = vport->adapter; 3868 - int vector; 3869 3856 3870 - for (vector = 0; vector < vport->num_q_vectors; vector++) { 3871 - struct idpf_q_vector *q_vector = &vport->q_vectors[vector]; 3857 + for (u16 vector = 0; vector < rsrc->num_q_vectors; vector++) { 3858 + struct idpf_q_vector *q_vector = &rsrc->q_vectors[vector]; 3872 3859 int irq_num, vidx; 3873 3860 3874 3861 /* free only the irqs that were actually requested */ 3875 3862 if (!q_vector) 3876 3863 continue; 3877 3864 3878 - vidx = vport->q_vector_idxs[vector]; 3865 + vidx = rsrc->q_vector_idxs[vector]; 3879 3866 irq_num = adapter->msix_entries[vidx].vector; 3880 3867 3881 3868 idpf_q_vector_set_napi(q_vector, false); ··· 3886 3871 3887 3872 /** 3888 3873 * idpf_vport_intr_dis_irq_all - Disable all interrupt 3889 - * @vport: main vport structure 3874 + * @rsrc: pointer to queue and vector resources 3890 3875 */ 3891 - static void idpf_vport_intr_dis_irq_all(struct idpf_vport *vport) 3876 + static void idpf_vport_intr_dis_irq_all(struct idpf_q_vec_rsrc *rsrc) 3892 3877 { 3893 - struct idpf_q_vector *q_vector = vport->q_vectors; 3894 - int q_idx; 3878 + struct idpf_q_vector *q_vector = rsrc->q_vectors; 3895 3879 3896 - writel(0, vport->noirq_dyn_ctl); 3880 + writel(0, rsrc->noirq_dyn_ctl); 3897 3881 3898 - for (q_idx = 0; q_idx < vport->num_q_vectors; q_idx++) 3882 + for (u16 q_idx = 0; q_idx < rsrc->num_q_vectors; q_idx++) 3899 3883 writel(0, q_vector[q_idx].intr_reg.dyn_ctl); 3900 3884 } 3901 3885 ··· 4040 4026 /** 4041 4027 * idpf_vport_intr_req_irq - get MSI-X vectors from the OS for the vport 4042 4028 * @vport: main vport structure 4029 + * @rsrc: pointer to queue and vector resources 4043 4030 * 4044 4031 * Return: 0 on success, negative on failure 4045 4032 */ 4046 - static int idpf_vport_intr_req_irq(struct idpf_vport *vport) 4033 + static int idpf_vport_intr_req_irq(struct idpf_vport *vport, 4034 + struct idpf_q_vec_rsrc *rsrc) 4047 4035 { 4048 4036 struct idpf_adapter *adapter = vport->adapter; 4049 4037 const char *drv_name, *if_name, *vec_name; ··· 4054 4038 drv_name = dev_driver_string(&adapter->pdev->dev); 4055 4039 if_name = netdev_name(vport->netdev); 4056 4040 4057 - for (vector = 0; vector < vport->num_q_vectors; vector++) { 4058 - struct idpf_q_vector *q_vector = &vport->q_vectors[vector]; 4041 + for (vector = 0; vector < rsrc->num_q_vectors; vector++) { 4042 + struct idpf_q_vector *q_vector = &rsrc->q_vectors[vector]; 4059 4043 char *name; 4060 4044 4061 - vidx = vport->q_vector_idxs[vector]; 4045 + vidx = rsrc->q_vector_idxs[vector]; 4062 4046 irq_num = adapter->msix_entries[vidx].vector; 4063 4047 4064 4048 if (q_vector->num_rxq && q_vector->num_txq) ··· 4088 4072 4089 4073 free_q_irqs: 4090 4074 while (--vector >= 0) { 4091 - vidx = vport->q_vector_idxs[vector]; 4075 + vidx = rsrc->q_vector_idxs[vector]; 4092 4076 irq_num = adapter->msix_entries[vidx].vector; 4093 - kfree(free_irq(irq_num, &vport->q_vectors[vector])); 4077 + kfree(free_irq(irq_num, &rsrc->q_vectors[vector])); 4094 4078 } 4095 4079 4096 4080 return err; ··· 4119 4103 /** 4120 4104 * idpf_vport_intr_ena_irq_all - Enable IRQ for the given vport 4121 4105 * @vport: main vport structure 4106 + * @rsrc: pointer to queue and vector resources 4122 4107 */ 4123 - static void idpf_vport_intr_ena_irq_all(struct idpf_vport *vport) 4108 + static void idpf_vport_intr_ena_irq_all(struct idpf_vport *vport, 4109 + struct idpf_q_vec_rsrc *rsrc) 4124 4110 { 4125 4111 bool dynamic; 4126 - int q_idx; 4127 4112 u16 itr; 4128 4113 4129 - for (q_idx = 0; q_idx < vport->num_q_vectors; q_idx++) { 4130 - struct idpf_q_vector *qv = &vport->q_vectors[q_idx]; 4114 + for (u16 q_idx = 0; q_idx < rsrc->num_q_vectors; q_idx++) { 4115 + struct idpf_q_vector *qv = &rsrc->q_vectors[q_idx]; 4131 4116 4132 4117 /* Set the initial ITR values */ 4133 4118 if (qv->num_txq) { ··· 4151 4134 idpf_vport_intr_update_itr_ena_irq(qv); 4152 4135 } 4153 4136 4154 - writel(vport->noirq_dyn_ctl_ena, vport->noirq_dyn_ctl); 4137 + writel(rsrc->noirq_dyn_ctl_ena, rsrc->noirq_dyn_ctl); 4155 4138 } 4156 4139 4157 4140 /** 4158 4141 * idpf_vport_intr_deinit - Release all vector associations for the vport 4159 4142 * @vport: main vport structure 4143 + * @rsrc: pointer to queue and vector resources 4160 4144 */ 4161 - void idpf_vport_intr_deinit(struct idpf_vport *vport) 4145 + void idpf_vport_intr_deinit(struct idpf_vport *vport, 4146 + struct idpf_q_vec_rsrc *rsrc) 4162 4147 { 4163 - idpf_vport_intr_dis_irq_all(vport); 4164 - idpf_vport_intr_napi_dis_all(vport); 4165 - idpf_vport_intr_napi_del_all(vport); 4166 - idpf_vport_intr_rel_irq(vport); 4148 + idpf_vport_intr_dis_irq_all(rsrc); 4149 + idpf_vport_intr_napi_dis_all(rsrc); 4150 + idpf_vport_intr_napi_del_all(rsrc); 4151 + idpf_vport_intr_rel_irq(vport, rsrc); 4167 4152 } 4168 4153 4169 4154 /** ··· 4237 4218 4238 4219 /** 4239 4220 * idpf_vport_intr_napi_ena_all - Enable NAPI for all q_vectors in the vport 4240 - * @vport: main vport structure 4221 + * @rsrc: pointer to queue and vector resources 4241 4222 */ 4242 - static void idpf_vport_intr_napi_ena_all(struct idpf_vport *vport) 4223 + static void idpf_vport_intr_napi_ena_all(struct idpf_q_vec_rsrc *rsrc) 4243 4224 { 4244 - int q_idx; 4245 - 4246 - for (q_idx = 0; q_idx < vport->num_q_vectors; q_idx++) { 4247 - struct idpf_q_vector *q_vector = &vport->q_vectors[q_idx]; 4225 + for (u16 q_idx = 0; q_idx < rsrc->num_q_vectors; q_idx++) { 4226 + struct idpf_q_vector *q_vector = &rsrc->q_vectors[q_idx]; 4248 4227 4249 4228 idpf_init_dim(q_vector); 4250 4229 napi_enable(&q_vector->napi); ··· 4372 4355 /** 4373 4356 * idpf_vport_intr_map_vector_to_qs - Map vectors to queues 4374 4357 * @vport: virtual port 4358 + * @rsrc: pointer to queue and vector resources 4375 4359 * 4376 4360 * Mapping for vectors to queues 4377 4361 */ 4378 - static void idpf_vport_intr_map_vector_to_qs(struct idpf_vport *vport) 4362 + static void idpf_vport_intr_map_vector_to_qs(struct idpf_vport *vport, 4363 + struct idpf_q_vec_rsrc *rsrc) 4379 4364 { 4380 - u16 num_txq_grp = vport->num_txq_grp - vport->num_xdp_txq; 4381 - bool split = idpf_is_queue_model_split(vport->rxq_model); 4365 + u16 num_txq_grp = rsrc->num_txq_grp - vport->num_xdp_txq; 4366 + bool split = idpf_is_queue_model_split(rsrc->rxq_model); 4382 4367 struct idpf_rxq_group *rx_qgrp; 4383 4368 struct idpf_txq_group *tx_qgrp; 4384 - u32 i, qv_idx, q_index; 4369 + u32 q_index; 4385 4370 4386 - for (i = 0, qv_idx = 0; i < vport->num_rxq_grp; i++) { 4371 + for (unsigned int i = 0, qv_idx = 0; i < rsrc->num_rxq_grp; i++) { 4387 4372 u16 num_rxq; 4388 4373 4389 - if (qv_idx >= vport->num_q_vectors) 4374 + if (qv_idx >= rsrc->num_q_vectors) 4390 4375 qv_idx = 0; 4391 4376 4392 - rx_qgrp = &vport->rxq_grps[i]; 4377 + rx_qgrp = &rsrc->rxq_grps[i]; 4393 4378 if (split) 4394 4379 num_rxq = rx_qgrp->splitq.num_rxq_sets; 4395 4380 else ··· 4404 4385 q = &rx_qgrp->splitq.rxq_sets[j]->rxq; 4405 4386 else 4406 4387 q = rx_qgrp->singleq.rxqs[j]; 4407 - q->q_vector = &vport->q_vectors[qv_idx]; 4388 + q->q_vector = &rsrc->q_vectors[qv_idx]; 4408 4389 q_index = q->q_vector->num_rxq; 4409 4390 q->q_vector->rx[q_index] = q; 4410 4391 q->q_vector->num_rxq++; ··· 4414 4395 } 4415 4396 4416 4397 if (split) { 4417 - for (u32 j = 0; j < vport->num_bufqs_per_qgrp; j++) { 4398 + for (u32 j = 0; j < rsrc->num_bufqs_per_qgrp; j++) { 4418 4399 struct idpf_buf_queue *bufq; 4419 4400 4420 4401 bufq = &rx_qgrp->splitq.bufq_sets[j].bufq; 4421 - bufq->q_vector = &vport->q_vectors[qv_idx]; 4402 + bufq->q_vector = &rsrc->q_vectors[qv_idx]; 4422 4403 q_index = bufq->q_vector->num_bufq; 4423 4404 bufq->q_vector->bufq[q_index] = bufq; 4424 4405 bufq->q_vector->num_bufq++; ··· 4428 4409 qv_idx++; 4429 4410 } 4430 4411 4431 - split = idpf_is_queue_model_split(vport->txq_model); 4412 + split = idpf_is_queue_model_split(rsrc->txq_model); 4432 4413 4433 - for (i = 0, qv_idx = 0; i < num_txq_grp; i++) { 4414 + for (unsigned int i = 0, qv_idx = 0; i < num_txq_grp; i++) { 4434 4415 u16 num_txq; 4435 4416 4436 - if (qv_idx >= vport->num_q_vectors) 4417 + if (qv_idx >= rsrc->num_q_vectors) 4437 4418 qv_idx = 0; 4438 4419 4439 - tx_qgrp = &vport->txq_grps[i]; 4420 + tx_qgrp = &rsrc->txq_grps[i]; 4440 4421 num_txq = tx_qgrp->num_txq; 4441 4422 4442 4423 for (u32 j = 0; j < num_txq; j++) { 4443 4424 struct idpf_tx_queue *q; 4444 4425 4445 4426 q = tx_qgrp->txqs[j]; 4446 - q->q_vector = &vport->q_vectors[qv_idx]; 4427 + q->q_vector = &rsrc->q_vectors[qv_idx]; 4447 4428 q->q_vector->tx[q->q_vector->num_txq++] = q; 4448 4429 } 4449 4430 4450 4431 if (split) { 4451 4432 struct idpf_compl_queue *q = tx_qgrp->complq; 4452 4433 4453 - q->q_vector = &vport->q_vectors[qv_idx]; 4434 + q->q_vector = &rsrc->q_vectors[qv_idx]; 4454 4435 q->q_vector->complq[q->q_vector->num_complq++] = q; 4455 4436 } 4456 4437 4457 4438 qv_idx++; 4458 4439 } 4459 4440 4460 - for (i = 0; i < vport->num_xdp_txq; i++) { 4441 + for (unsigned int i = 0; i < vport->num_xdp_txq; i++) { 4461 4442 struct idpf_tx_queue *xdpsq; 4462 4443 struct idpf_q_vector *qv; 4463 4444 4464 - xdpsq = vport->txqs[vport->xdp_txq_offset + i]; 4445 + xdpsq = vport->txqs[rsrc->xdp_txq_offset + i]; 4465 4446 if (!idpf_queue_has(XSK, xdpsq)) 4466 4447 continue; 4467 4448 ··· 4476 4457 /** 4477 4458 * idpf_vport_intr_init_vec_idx - Initialize the vector indexes 4478 4459 * @vport: virtual port 4460 + * @rsrc: pointer to queue and vector resources 4479 4461 * 4480 4462 * Initialize vector indexes with values returned over mailbox. 4481 4463 * 4482 4464 * Return: 0 on success, negative on failure 4483 4465 */ 4484 - static int idpf_vport_intr_init_vec_idx(struct idpf_vport *vport) 4466 + static int idpf_vport_intr_init_vec_idx(struct idpf_vport *vport, 4467 + struct idpf_q_vec_rsrc *rsrc) 4485 4468 { 4486 4469 struct idpf_adapter *adapter = vport->adapter; 4487 4470 struct virtchnl2_alloc_vectors *ac; ··· 4492 4471 4493 4472 ac = adapter->req_vec_chunks; 4494 4473 if (!ac) { 4495 - for (i = 0; i < vport->num_q_vectors; i++) 4496 - vport->q_vectors[i].v_idx = vport->q_vector_idxs[i]; 4474 + for (i = 0; i < rsrc->num_q_vectors; i++) 4475 + rsrc->q_vectors[i].v_idx = rsrc->q_vector_idxs[i]; 4497 4476 4498 - vport->noirq_v_idx = vport->q_vector_idxs[i]; 4477 + rsrc->noirq_v_idx = rsrc->q_vector_idxs[i]; 4499 4478 4500 4479 return 0; 4501 4480 } ··· 4507 4486 4508 4487 idpf_get_vec_ids(adapter, vecids, total_vecs, &ac->vchunks); 4509 4488 4510 - for (i = 0; i < vport->num_q_vectors; i++) 4511 - vport->q_vectors[i].v_idx = vecids[vport->q_vector_idxs[i]]; 4489 + for (i = 0; i < rsrc->num_q_vectors; i++) 4490 + rsrc->q_vectors[i].v_idx = vecids[rsrc->q_vector_idxs[i]]; 4512 4491 4513 - vport->noirq_v_idx = vecids[vport->q_vector_idxs[i]]; 4492 + rsrc->noirq_v_idx = vecids[rsrc->q_vector_idxs[i]]; 4514 4493 4515 4494 kfree(vecids); 4516 4495 ··· 4520 4499 /** 4521 4500 * idpf_vport_intr_napi_add_all- Register napi handler for all qvectors 4522 4501 * @vport: virtual port structure 4502 + * @rsrc: pointer to queue and vector resources 4523 4503 */ 4524 - static void idpf_vport_intr_napi_add_all(struct idpf_vport *vport) 4504 + static void idpf_vport_intr_napi_add_all(struct idpf_vport *vport, 4505 + struct idpf_q_vec_rsrc *rsrc) 4525 4506 { 4526 4507 int (*napi_poll)(struct napi_struct *napi, int budget); 4527 - u16 v_idx, qv_idx; 4528 4508 int irq_num; 4509 + u16 qv_idx; 4529 4510 4530 - if (idpf_is_queue_model_split(vport->txq_model)) 4511 + if (idpf_is_queue_model_split(rsrc->txq_model)) 4531 4512 napi_poll = idpf_vport_splitq_napi_poll; 4532 4513 else 4533 4514 napi_poll = idpf_vport_singleq_napi_poll; 4534 4515 4535 - for (v_idx = 0; v_idx < vport->num_q_vectors; v_idx++) { 4536 - struct idpf_q_vector *q_vector = &vport->q_vectors[v_idx]; 4537 - qv_idx = vport->q_vector_idxs[v_idx]; 4516 + for (u16 v_idx = 0; v_idx < rsrc->num_q_vectors; v_idx++) { 4517 + struct idpf_q_vector *q_vector = &rsrc->q_vectors[v_idx]; 4518 + 4519 + qv_idx = rsrc->q_vector_idxs[v_idx]; 4538 4520 irq_num = vport->adapter->msix_entries[qv_idx].vector; 4539 4521 4540 4522 netif_napi_add_config(vport->netdev, &q_vector->napi, ··· 4549 4525 /** 4550 4526 * idpf_vport_intr_alloc - Allocate memory for interrupt vectors 4551 4527 * @vport: virtual port 4528 + * @rsrc: pointer to queue and vector resources 4552 4529 * 4553 4530 * Allocate one q_vector per queue interrupt. 4554 4531 * 4555 4532 * Return: 0 on success, if allocation fails we return -ENOMEM. 4556 4533 */ 4557 - int idpf_vport_intr_alloc(struct idpf_vport *vport) 4534 + int idpf_vport_intr_alloc(struct idpf_vport *vport, 4535 + struct idpf_q_vec_rsrc *rsrc) 4558 4536 { 4559 4537 u16 txqs_per_vector, rxqs_per_vector, bufqs_per_vector; 4560 4538 struct idpf_vport_user_config_data *user_config; 4561 4539 struct idpf_q_vector *q_vector; 4562 4540 struct idpf_q_coalesce *q_coal; 4563 - u32 complqs_per_vector, v_idx; 4541 + u32 complqs_per_vector; 4564 4542 u16 idx = vport->idx; 4565 4543 4566 4544 user_config = &vport->adapter->vport_config[idx]->user_config; 4567 - vport->q_vectors = kcalloc(vport->num_q_vectors, 4568 - sizeof(struct idpf_q_vector), GFP_KERNEL); 4569 - if (!vport->q_vectors) 4545 + 4546 + rsrc->q_vectors = kcalloc(rsrc->num_q_vectors, 4547 + sizeof(struct idpf_q_vector), GFP_KERNEL); 4548 + if (!rsrc->q_vectors) 4570 4549 return -ENOMEM; 4571 4550 4572 - txqs_per_vector = DIV_ROUND_UP(vport->num_txq_grp, 4573 - vport->num_q_vectors); 4574 - rxqs_per_vector = DIV_ROUND_UP(vport->num_rxq_grp, 4575 - vport->num_q_vectors); 4576 - bufqs_per_vector = vport->num_bufqs_per_qgrp * 4577 - DIV_ROUND_UP(vport->num_rxq_grp, 4578 - vport->num_q_vectors); 4579 - complqs_per_vector = DIV_ROUND_UP(vport->num_txq_grp, 4580 - vport->num_q_vectors); 4551 + txqs_per_vector = DIV_ROUND_UP(rsrc->num_txq_grp, 4552 + rsrc->num_q_vectors); 4553 + rxqs_per_vector = DIV_ROUND_UP(rsrc->num_rxq_grp, 4554 + rsrc->num_q_vectors); 4555 + bufqs_per_vector = rsrc->num_bufqs_per_qgrp * 4556 + DIV_ROUND_UP(rsrc->num_rxq_grp, 4557 + rsrc->num_q_vectors); 4558 + complqs_per_vector = DIV_ROUND_UP(rsrc->num_txq_grp, 4559 + rsrc->num_q_vectors); 4581 4560 4582 - for (v_idx = 0; v_idx < vport->num_q_vectors; v_idx++) { 4583 - q_vector = &vport->q_vectors[v_idx]; 4561 + for (u16 v_idx = 0; v_idx < rsrc->num_q_vectors; v_idx++) { 4562 + q_vector = &rsrc->q_vectors[v_idx]; 4584 4563 q_coal = &user_config->q_coalesce[v_idx]; 4585 4564 q_vector->vport = vport; 4586 4565 ··· 4605 4578 if (!q_vector->rx) 4606 4579 goto error; 4607 4580 4608 - if (!idpf_is_queue_model_split(vport->rxq_model)) 4581 + if (!idpf_is_queue_model_split(rsrc->rxq_model)) 4609 4582 continue; 4610 4583 4611 4584 q_vector->bufq = kcalloc(bufqs_per_vector, ··· 4620 4593 if (!q_vector->complq) 4621 4594 goto error; 4622 4595 4623 - if (!vport->xdp_txq_offset) 4596 + if (!rsrc->xdp_txq_offset) 4624 4597 continue; 4625 4598 4626 4599 q_vector->xsksq = kcalloc(rxqs_per_vector, ··· 4633 4606 return 0; 4634 4607 4635 4608 error: 4636 - idpf_vport_intr_rel(vport); 4609 + idpf_vport_intr_rel(rsrc); 4637 4610 4638 4611 return -ENOMEM; 4639 4612 } ··· 4641 4614 /** 4642 4615 * idpf_vport_intr_init - Setup all vectors for the given vport 4643 4616 * @vport: virtual port 4617 + * @rsrc: pointer to queue and vector resources 4644 4618 * 4645 4619 * Return: 0 on success or negative on failure 4646 4620 */ 4647 - int idpf_vport_intr_init(struct idpf_vport *vport) 4621 + int idpf_vport_intr_init(struct idpf_vport *vport, struct idpf_q_vec_rsrc *rsrc) 4648 4622 { 4649 4623 int err; 4650 4624 4651 - err = idpf_vport_intr_init_vec_idx(vport); 4625 + err = idpf_vport_intr_init_vec_idx(vport, rsrc); 4652 4626 if (err) 4653 4627 return err; 4654 4628 4655 - idpf_vport_intr_map_vector_to_qs(vport); 4656 - idpf_vport_intr_napi_add_all(vport); 4629 + idpf_vport_intr_map_vector_to_qs(vport, rsrc); 4630 + idpf_vport_intr_napi_add_all(vport, rsrc); 4657 4631 4658 - err = vport->adapter->dev_ops.reg_ops.intr_reg_init(vport); 4632 + err = vport->adapter->dev_ops.reg_ops.intr_reg_init(vport, rsrc); 4659 4633 if (err) 4660 4634 goto unroll_vectors_alloc; 4661 4635 4662 - err = idpf_vport_intr_req_irq(vport); 4636 + err = idpf_vport_intr_req_irq(vport, rsrc); 4663 4637 if (err) 4664 4638 goto unroll_vectors_alloc; 4665 4639 4666 4640 return 0; 4667 4641 4668 4642 unroll_vectors_alloc: 4669 - idpf_vport_intr_napi_del_all(vport); 4643 + idpf_vport_intr_napi_del_all(rsrc); 4670 4644 4671 4645 return err; 4672 4646 } 4673 4647 4674 - void idpf_vport_intr_ena(struct idpf_vport *vport) 4648 + void idpf_vport_intr_ena(struct idpf_vport *vport, struct idpf_q_vec_rsrc *rsrc) 4675 4649 { 4676 - idpf_vport_intr_napi_ena_all(vport); 4677 - idpf_vport_intr_ena_irq_all(vport); 4650 + idpf_vport_intr_napi_ena_all(rsrc); 4651 + idpf_vport_intr_ena_irq_all(vport, rsrc); 4678 4652 } 4679 4653 4680 4654 /** 4681 4655 * idpf_config_rss - Send virtchnl messages to configure RSS 4682 4656 * @vport: virtual port 4657 + * @rss_data: pointer to RSS key and lut info 4683 4658 * 4684 4659 * Return: 0 on success, negative on failure 4685 4660 */ 4686 - int idpf_config_rss(struct idpf_vport *vport) 4661 + int idpf_config_rss(struct idpf_vport *vport, struct idpf_rss_data *rss_data) 4687 4662 { 4663 + struct idpf_adapter *adapter = vport->adapter; 4664 + u32 vport_id = vport->vport_id; 4688 4665 int err; 4689 4666 4690 - err = idpf_send_get_set_rss_key_msg(vport, false); 4667 + err = idpf_send_get_set_rss_key_msg(adapter, rss_data, vport_id, false); 4691 4668 if (err) 4692 4669 return err; 4693 4670 4694 - return idpf_send_get_set_rss_lut_msg(vport, false); 4671 + return idpf_send_get_set_rss_lut_msg(adapter, rss_data, vport_id, false); 4695 4672 } 4696 4673 4697 4674 /** 4698 4675 * idpf_fill_dflt_rss_lut - Fill the indirection table with the default values 4699 4676 * @vport: virtual port structure 4677 + * @rss_data: pointer to RSS key and lut info 4700 4678 */ 4701 - void idpf_fill_dflt_rss_lut(struct idpf_vport *vport) 4679 + void idpf_fill_dflt_rss_lut(struct idpf_vport *vport, 4680 + struct idpf_rss_data *rss_data) 4702 4681 { 4703 - struct idpf_adapter *adapter = vport->adapter; 4704 - u16 num_active_rxq = vport->num_rxq; 4705 - struct idpf_rss_data *rss_data; 4682 + u16 num_active_rxq = vport->dflt_qv_rsrc.num_rxq; 4706 4683 int i; 4707 - 4708 - rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data; 4709 4684 4710 4685 for (i = 0; i < rss_data->rss_lut_size; i++) 4711 4686 rss_data->rss_lut[i] = i % num_active_rxq; ··· 4716 4687 /** 4717 4688 * idpf_init_rss_lut - Allocate and initialize RSS LUT 4718 4689 * @vport: virtual port 4690 + * @rss_data: pointer to RSS key and lut info 4719 4691 * 4720 4692 * Return: 0 on success, negative on failure 4721 4693 */ 4722 - int idpf_init_rss_lut(struct idpf_vport *vport) 4694 + int idpf_init_rss_lut(struct idpf_vport *vport, struct idpf_rss_data *rss_data) 4723 4695 { 4724 - struct idpf_adapter *adapter = vport->adapter; 4725 - struct idpf_rss_data *rss_data; 4726 - 4727 - rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data; 4728 4696 if (!rss_data->rss_lut) { 4729 4697 u32 lut_size; 4730 4698 ··· 4732 4706 } 4733 4707 4734 4708 /* Fill the default RSS lut values */ 4735 - idpf_fill_dflt_rss_lut(vport); 4709 + idpf_fill_dflt_rss_lut(vport, rss_data); 4736 4710 4737 4711 return 0; 4738 4712 } 4739 4713 4740 4714 /** 4741 4715 * idpf_deinit_rss_lut - Release RSS LUT 4742 - * @vport: virtual port 4716 + * @rss_data: pointer to RSS key and lut info 4743 4717 */ 4744 - void idpf_deinit_rss_lut(struct idpf_vport *vport) 4718 + void idpf_deinit_rss_lut(struct idpf_rss_data *rss_data) 4745 4719 { 4746 - struct idpf_adapter *adapter = vport->adapter; 4747 - struct idpf_rss_data *rss_data; 4748 - 4749 - rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data; 4750 4720 kfree(rss_data->rss_lut); 4751 4721 rss_data->rss_lut = NULL; 4752 4722 }
+29 -15
drivers/net/ethernet/intel/idpf/idpf_txrx.h
··· 283 283 * @__IDPF_Q_FLOW_SCH_EN: Enable flow scheduling 284 284 * @__IDPF_Q_SW_MARKER: Used to indicate TX queue marker completions 285 285 * @__IDPF_Q_CRC_EN: enable CRC offload in singleq mode 286 + * @__IDPF_Q_RSC_EN: enable Receive Side Coalescing on Rx (splitq) 286 287 * @__IDPF_Q_HSPLIT_EN: enable header split on Rx (splitq) 287 288 * @__IDPF_Q_PTP: indicates whether the Rx timestamping is enabled for the 288 289 * queue ··· 298 297 __IDPF_Q_FLOW_SCH_EN, 299 298 __IDPF_Q_SW_MARKER, 300 299 __IDPF_Q_CRC_EN, 300 + __IDPF_Q_RSC_EN, 301 301 __IDPF_Q_HSPLIT_EN, 302 302 __IDPF_Q_PTP, 303 303 __IDPF_Q_NOIRQ, ··· 927 925 * @singleq.rxqs: Array of RX queue pointers 928 926 * @splitq: Struct with split queue related members 929 927 * @splitq.num_rxq_sets: Number of RX queue sets 928 + * @splitq.num_rxq_sets: Number of Buffer queue sets 930 929 * @splitq.rxq_sets: Array of RX queue sets 931 930 * @splitq.bufq_sets: Buffer queue set pointer 932 931 * ··· 945 942 } singleq; 946 943 struct { 947 944 u16 num_rxq_sets; 945 + u16 num_bufq_sets; 948 946 struct idpf_rxq_set *rxq_sets[IDPF_LARGE_MAX_Q]; 949 947 struct idpf_bufq_set *bufq_sets; 950 948 } splitq; ··· 1076 1072 1077 1073 int idpf_vport_singleq_napi_poll(struct napi_struct *napi, int budget); 1078 1074 void idpf_vport_init_num_qs(struct idpf_vport *vport, 1079 - struct virtchnl2_create_vport *vport_msg); 1080 - void idpf_vport_calc_num_q_desc(struct idpf_vport *vport); 1075 + struct virtchnl2_create_vport *vport_msg, 1076 + struct idpf_q_vec_rsrc *rsrc); 1077 + void idpf_vport_calc_num_q_desc(struct idpf_vport *vport, 1078 + struct idpf_q_vec_rsrc *rsrc); 1081 1079 int idpf_vport_calc_total_qs(struct idpf_adapter *adapter, u16 vport_index, 1082 1080 struct virtchnl2_create_vport *vport_msg, 1083 1081 struct idpf_vport_max_q *max_q); 1084 - void idpf_vport_calc_num_q_groups(struct idpf_vport *vport); 1085 - int idpf_vport_queues_alloc(struct idpf_vport *vport); 1086 - void idpf_vport_queues_rel(struct idpf_vport *vport); 1087 - void idpf_vport_intr_rel(struct idpf_vport *vport); 1088 - int idpf_vport_intr_alloc(struct idpf_vport *vport); 1082 + void idpf_vport_calc_num_q_groups(struct idpf_q_vec_rsrc *rsrc); 1083 + int idpf_vport_queues_alloc(struct idpf_vport *vport, 1084 + struct idpf_q_vec_rsrc *rsrc); 1085 + void idpf_vport_queues_rel(struct idpf_vport *vport, 1086 + struct idpf_q_vec_rsrc *rsrc); 1087 + void idpf_vport_intr_rel(struct idpf_q_vec_rsrc *rsrc); 1088 + int idpf_vport_intr_alloc(struct idpf_vport *vport, 1089 + struct idpf_q_vec_rsrc *rsrc); 1089 1090 void idpf_vport_intr_update_itr_ena_irq(struct idpf_q_vector *q_vector); 1090 - void idpf_vport_intr_deinit(struct idpf_vport *vport); 1091 - int idpf_vport_intr_init(struct idpf_vport *vport); 1092 - void idpf_vport_intr_ena(struct idpf_vport *vport); 1093 - void idpf_fill_dflt_rss_lut(struct idpf_vport *vport); 1094 - int idpf_config_rss(struct idpf_vport *vport); 1095 - int idpf_init_rss_lut(struct idpf_vport *vport); 1096 - void idpf_deinit_rss_lut(struct idpf_vport *vport); 1097 - int idpf_rx_bufs_init_all(struct idpf_vport *vport); 1091 + void idpf_vport_intr_deinit(struct idpf_vport *vport, 1092 + struct idpf_q_vec_rsrc *rsrc); 1093 + int idpf_vport_intr_init(struct idpf_vport *vport, 1094 + struct idpf_q_vec_rsrc *rsrc); 1095 + void idpf_vport_intr_ena(struct idpf_vport *vport, 1096 + struct idpf_q_vec_rsrc *rsrc); 1097 + void idpf_fill_dflt_rss_lut(struct idpf_vport *vport, 1098 + struct idpf_rss_data *rss_data); 1099 + int idpf_config_rss(struct idpf_vport *vport, struct idpf_rss_data *rss_data); 1100 + int idpf_init_rss_lut(struct idpf_vport *vport, struct idpf_rss_data *rss_data); 1101 + void idpf_deinit_rss_lut(struct idpf_rss_data *rss_data); 1102 + int idpf_rx_bufs_init_all(struct idpf_vport *vport, 1103 + struct idpf_q_vec_rsrc *rsrc); 1098 1104 1099 1105 struct idpf_q_vector *idpf_find_rxq_vec(const struct idpf_vport *vport, 1100 1106 u32 q_num);
+12 -9
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c
··· 69 69 /** 70 70 * idpf_vf_intr_reg_init - Initialize interrupt registers 71 71 * @vport: virtual port structure 72 + * @rsrc: pointer to queue and vector resources 72 73 */ 73 - static int idpf_vf_intr_reg_init(struct idpf_vport *vport) 74 + static int idpf_vf_intr_reg_init(struct idpf_vport *vport, 75 + struct idpf_q_vec_rsrc *rsrc) 74 76 { 75 77 struct idpf_adapter *adapter = vport->adapter; 76 - int num_vecs = vport->num_q_vectors; 78 + u16 num_vecs = rsrc->num_q_vectors; 77 79 struct idpf_vec_regs *reg_vals; 78 80 int num_regs, i, err = 0; 79 81 u32 rx_itr, tx_itr, val; ··· 87 85 if (!reg_vals) 88 86 return -ENOMEM; 89 87 90 - num_regs = idpf_get_reg_intr_vecs(vport, reg_vals); 88 + num_regs = idpf_get_reg_intr_vecs(adapter, reg_vals); 91 89 if (num_regs < num_vecs) { 92 90 err = -EINVAL; 93 91 goto free_reg_vals; 94 92 } 95 93 96 94 for (i = 0; i < num_vecs; i++) { 97 - struct idpf_q_vector *q_vector = &vport->q_vectors[i]; 98 - u16 vec_id = vport->q_vector_idxs[i] - IDPF_MBX_Q_VEC; 95 + struct idpf_q_vector *q_vector = &rsrc->q_vectors[i]; 96 + u16 vec_id = rsrc->q_vector_idxs[i] - IDPF_MBX_Q_VEC; 99 97 struct idpf_intr_reg *intr = &q_vector->intr_reg; 100 98 u32 spacing; 101 99 ··· 124 122 125 123 /* Data vector for NOIRQ queues */ 126 124 127 - val = reg_vals[vport->q_vector_idxs[i] - IDPF_MBX_Q_VEC].dyn_ctl_reg; 128 - vport->noirq_dyn_ctl = idpf_get_reg_addr(adapter, val); 125 + val = reg_vals[rsrc->q_vector_idxs[i] - IDPF_MBX_Q_VEC].dyn_ctl_reg; 126 + rsrc->noirq_dyn_ctl = idpf_get_reg_addr(adapter, val); 129 127 130 128 val = VF_INT_DYN_CTLN_WB_ON_ITR_M | VF_INT_DYN_CTLN_INTENA_MSK_M | 131 129 FIELD_PREP(VF_INT_DYN_CTLN_ITR_INDX_M, IDPF_NO_ITR_UPDATE_IDX); 132 - vport->noirq_dyn_ctl_ena = val; 130 + rsrc->noirq_dyn_ctl_ena = val; 133 131 134 132 free_reg_vals: 135 133 kfree(reg_vals); ··· 158 156 /* Do not send VIRTCHNL2_OP_RESET_VF message on driver unload */ 159 157 if (trig_cause == IDPF_HR_FUNC_RESET && 160 158 !test_bit(IDPF_REMOVE_IN_PROG, adapter->flags)) 161 - idpf_send_mb_msg(adapter, VIRTCHNL2_OP_RESET_VF, 0, NULL, 0); 159 + idpf_send_mb_msg(adapter, adapter->hw.asq, 160 + VIRTCHNL2_OP_RESET_VF, 0, NULL, 0); 162 161 } 163 162 164 163 /**
+597 -501
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
··· 117 117 118 118 /** 119 119 * idpf_mb_clean - Reclaim the send mailbox queue entries 120 - * @adapter: Driver specific private structure 120 + * @adapter: driver specific private structure 121 + * @asq: send control queue info 121 122 * 122 123 * Reclaim the send mailbox queue entries to be used to send further messages 123 124 * 124 - * Returns 0 on success, negative on failure 125 + * Return: 0 on success, negative on failure 125 126 */ 126 - static int idpf_mb_clean(struct idpf_adapter *adapter) 127 + static int idpf_mb_clean(struct idpf_adapter *adapter, 128 + struct idpf_ctlq_info *asq) 127 129 { 128 130 u16 i, num_q_msg = IDPF_DFLT_MBX_Q_LEN; 129 131 struct idpf_ctlq_msg **q_msg; ··· 136 134 if (!q_msg) 137 135 return -ENOMEM; 138 136 139 - err = idpf_ctlq_clean_sq(adapter->hw.asq, &num_q_msg, q_msg); 137 + err = idpf_ctlq_clean_sq(asq, &num_q_msg, q_msg); 140 138 if (err) 141 139 goto err_kfree; 142 140 ··· 208 206 209 207 /** 210 208 * idpf_send_mb_msg - Send message over mailbox 211 - * @adapter: Driver specific private structure 209 + * @adapter: driver specific private structure 210 + * @asq: control queue to send message to 212 211 * @op: virtchnl opcode 213 212 * @msg_size: size of the payload 214 213 * @msg: pointer to buffer holding the payload ··· 217 214 * 218 215 * Will prepare the control queue message and initiates the send api 219 216 * 220 - * Returns 0 on success, negative on failure 217 + * Return: 0 on success, negative on failure 221 218 */ 222 - int idpf_send_mb_msg(struct idpf_adapter *adapter, u32 op, 223 - u16 msg_size, u8 *msg, u16 cookie) 219 + int idpf_send_mb_msg(struct idpf_adapter *adapter, struct idpf_ctlq_info *asq, 220 + u32 op, u16 msg_size, u8 *msg, u16 cookie) 224 221 { 225 222 struct idpf_ctlq_msg *ctlq_msg; 226 223 struct idpf_dma_mem *dma_mem; ··· 234 231 if (idpf_is_reset_detected(adapter)) 235 232 return 0; 236 233 237 - err = idpf_mb_clean(adapter); 234 + err = idpf_mb_clean(adapter, asq); 238 235 if (err) 239 236 return err; 240 237 ··· 270 267 ctlq_msg->ctx.indirect.payload = dma_mem; 271 268 ctlq_msg->ctx.sw_cookie.data = cookie; 272 269 273 - err = idpf_ctlq_send(&adapter->hw, adapter->hw.asq, 1, ctlq_msg); 270 + err = idpf_ctlq_send(&adapter->hw, asq, 1, ctlq_msg); 274 271 if (err) 275 272 goto send_error; 276 273 ··· 466 463 cookie = FIELD_PREP(IDPF_VC_XN_SALT_M, xn->salt) | 467 464 FIELD_PREP(IDPF_VC_XN_IDX_M, xn->idx); 468 465 469 - retval = idpf_send_mb_msg(adapter, params->vc_op, 466 + retval = idpf_send_mb_msg(adapter, adapter->hw.asq, params->vc_op, 470 467 send_buf->iov_len, send_buf->iov_base, 471 468 cookie); 472 469 if (retval) { ··· 665 662 666 663 /** 667 664 * idpf_recv_mb_msg - Receive message over mailbox 668 - * @adapter: Driver specific private structure 665 + * @adapter: driver specific private structure 666 + * @arq: control queue to receive message from 669 667 * 670 - * Will receive control queue message and posts the receive buffer. Returns 0 671 - * on success and negative on failure. 668 + * Will receive control queue message and posts the receive buffer. 669 + * 670 + * Return: 0 on success and negative on failure. 672 671 */ 673 - int idpf_recv_mb_msg(struct idpf_adapter *adapter) 672 + int idpf_recv_mb_msg(struct idpf_adapter *adapter, struct idpf_ctlq_info *arq) 674 673 { 675 674 struct idpf_ctlq_msg ctlq_msg; 676 675 struct idpf_dma_mem *dma_mem; ··· 684 679 * actually received on num_recv. 685 680 */ 686 681 num_recv = 1; 687 - err = idpf_ctlq_recv(adapter->hw.arq, &num_recv, &ctlq_msg); 682 + err = idpf_ctlq_recv(arq, &num_recv, &ctlq_msg); 688 683 if (err || !num_recv) 689 684 break; 690 685 ··· 700 695 else 701 696 err = idpf_vc_xn_forward_reply(adapter, &ctlq_msg); 702 697 703 - post_err = idpf_ctlq_post_rx_buffs(&adapter->hw, 704 - adapter->hw.arq, 698 + post_err = idpf_ctlq_post_rx_buffs(&adapter->hw, arq, 705 699 &num_recv, &dma_mem); 706 700 707 701 /* If post failed clear the only buffer we supplied */ ··· 721 717 } 722 718 723 719 struct idpf_chunked_msg_params { 724 - u32 (*prepare_msg)(const struct idpf_vport *vport, 725 - void *buf, const void *pos, 726 - u32 num); 720 + u32 (*prepare_msg)(u32 vport_id, void *buf, 721 + const void *pos, u32 num); 727 722 728 723 const void *chunks; 729 724 u32 num_chunks; ··· 731 728 u32 config_sz; 732 729 733 730 u32 vc_op; 731 + u32 vport_id; 734 732 }; 735 733 736 - struct idpf_queue_set *idpf_alloc_queue_set(struct idpf_vport *vport, u32 num) 734 + struct idpf_queue_set *idpf_alloc_queue_set(struct idpf_adapter *adapter, 735 + struct idpf_q_vec_rsrc *qv_rsrc, 736 + u32 vport_id, u32 num) 737 737 { 738 738 struct idpf_queue_set *qp; 739 739 ··· 744 738 if (!qp) 745 739 return NULL; 746 740 747 - qp->vport = vport; 741 + qp->adapter = adapter; 742 + qp->qv_rsrc = qv_rsrc; 743 + qp->vport_id = vport_id; 748 744 qp->num = num; 749 745 750 746 return qp; ··· 754 746 755 747 /** 756 748 * idpf_send_chunked_msg - send VC message consisting of chunks 757 - * @vport: virtual port data structure 749 + * @adapter: Driver specific private structure 758 750 * @params: message params 759 751 * 760 752 * Helper function for preparing a message describing queues to be enabled ··· 762 754 * 763 755 * Return: the total size of the prepared message. 764 756 */ 765 - static int idpf_send_chunked_msg(struct idpf_vport *vport, 757 + static int idpf_send_chunked_msg(struct idpf_adapter *adapter, 766 758 const struct idpf_chunked_msg_params *params) 767 759 { 768 760 struct idpf_vc_xn_params xn_params = { ··· 773 765 u32 num_chunks, num_msgs, buf_sz; 774 766 void *buf __free(kfree) = NULL; 775 767 u32 totqs = params->num_chunks; 768 + u32 vid = params->vport_id; 776 769 777 770 num_chunks = min(IDPF_NUM_CHUNKS_PER_MSG(params->config_sz, 778 771 params->chunk_sz), totqs); ··· 792 783 memset(buf, 0, buf_sz); 793 784 xn_params.send_buf.iov_len = buf_sz; 794 785 795 - if (params->prepare_msg(vport, buf, pos, num_chunks) != buf_sz) 786 + if (params->prepare_msg(vid, buf, pos, num_chunks) != buf_sz) 796 787 return -EINVAL; 797 788 798 - reply_sz = idpf_vc_xn_exec(vport->adapter, &xn_params); 789 + reply_sz = idpf_vc_xn_exec(adapter, &xn_params); 799 790 if (reply_sz < 0) 800 791 return reply_sz; 801 792 ··· 818 809 */ 819 810 static int idpf_wait_for_marker_event_set(const struct idpf_queue_set *qs) 820 811 { 812 + struct net_device *netdev; 821 813 struct idpf_tx_queue *txq; 822 814 bool markers_rcvd = true; 823 815 ··· 826 816 switch (qs->qs[i].type) { 827 817 case VIRTCHNL2_QUEUE_TYPE_TX: 828 818 txq = qs->qs[i].txq; 819 + 820 + netdev = txq->netdev; 829 821 830 822 idpf_queue_set(SW_MARKER, txq); 831 823 idpf_wait_for_sw_marker_completion(txq); ··· 839 827 } 840 828 841 829 if (!markers_rcvd) { 842 - netdev_warn(qs->vport->netdev, 830 + netdev_warn(netdev, 843 831 "Failed to receive marker packets\n"); 844 832 return -ETIMEDOUT; 845 833 } ··· 857 845 { 858 846 struct idpf_queue_set *qs __free(kfree) = NULL; 859 847 860 - qs = idpf_alloc_queue_set(vport, vport->num_txq); 848 + qs = idpf_alloc_queue_set(vport->adapter, &vport->dflt_qv_rsrc, 849 + vport->vport_id, vport->num_txq); 861 850 if (!qs) 862 851 return -ENOMEM; 863 852 ··· 1276 1263 } 1277 1264 1278 1265 /** 1266 + * idpf_vport_init_queue_reg_chunks - initialize queue register chunks 1267 + * @vport_config: persistent vport structure to store the queue register info 1268 + * @schunks: source chunks to copy data from 1269 + * 1270 + * Return: 0 on success, negative on failure. 1271 + */ 1272 + static int 1273 + idpf_vport_init_queue_reg_chunks(struct idpf_vport_config *vport_config, 1274 + struct virtchnl2_queue_reg_chunks *schunks) 1275 + { 1276 + struct idpf_queue_id_reg_info *q_info = &vport_config->qid_reg_info; 1277 + u16 num_chunks = le16_to_cpu(schunks->num_chunks); 1278 + 1279 + kfree(q_info->queue_chunks); 1280 + 1281 + q_info->queue_chunks = kcalloc(num_chunks, sizeof(*q_info->queue_chunks), 1282 + GFP_KERNEL); 1283 + if (!q_info->queue_chunks) { 1284 + q_info->num_chunks = 0; 1285 + return -ENOMEM; 1286 + } 1287 + 1288 + q_info->num_chunks = num_chunks; 1289 + 1290 + for (u16 i = 0; i < num_chunks; i++) { 1291 + struct idpf_queue_id_reg_chunk *dchunk = &q_info->queue_chunks[i]; 1292 + struct virtchnl2_queue_reg_chunk *schunk = &schunks->chunks[i]; 1293 + 1294 + dchunk->qtail_reg_start = le64_to_cpu(schunk->qtail_reg_start); 1295 + dchunk->qtail_reg_spacing = le32_to_cpu(schunk->qtail_reg_spacing); 1296 + dchunk->type = le32_to_cpu(schunk->type); 1297 + dchunk->start_queue_id = le32_to_cpu(schunk->start_queue_id); 1298 + dchunk->num_queues = le32_to_cpu(schunk->num_queues); 1299 + } 1300 + 1301 + return 0; 1302 + } 1303 + 1304 + /** 1279 1305 * idpf_get_reg_intr_vecs - Get vector queue register offset 1280 - * @vport: virtual port structure 1306 + * @adapter: adapter structure to get the vector chunks 1281 1307 * @reg_vals: Register offsets to store in 1282 1308 * 1283 - * Returns number of registers that got populated 1309 + * Return: number of registers that got populated 1284 1310 */ 1285 - int idpf_get_reg_intr_vecs(struct idpf_vport *vport, 1311 + int idpf_get_reg_intr_vecs(struct idpf_adapter *adapter, 1286 1312 struct idpf_vec_regs *reg_vals) 1287 1313 { 1288 1314 struct virtchnl2_vector_chunks *chunks; ··· 1329 1277 u16 num_vchunks, num_vec; 1330 1278 int num_regs = 0, i, j; 1331 1279 1332 - chunks = &vport->adapter->req_vec_chunks->vchunks; 1280 + chunks = &adapter->req_vec_chunks->vchunks; 1333 1281 num_vchunks = le16_to_cpu(chunks->num_vchunks); 1334 1282 1335 1283 for (j = 0; j < num_vchunks; j++) { ··· 1374 1322 * are filled. 1375 1323 */ 1376 1324 static int idpf_vport_get_q_reg(u32 *reg_vals, int num_regs, u32 q_type, 1377 - struct virtchnl2_queue_reg_chunks *chunks) 1325 + struct idpf_queue_id_reg_info *chunks) 1378 1326 { 1379 - u16 num_chunks = le16_to_cpu(chunks->num_chunks); 1327 + u16 num_chunks = chunks->num_chunks; 1380 1328 int reg_filled = 0, i; 1381 1329 u32 reg_val; 1382 1330 1383 1331 while (num_chunks--) { 1384 - struct virtchnl2_queue_reg_chunk *chunk; 1332 + struct idpf_queue_id_reg_chunk *chunk; 1385 1333 u16 num_q; 1386 1334 1387 - chunk = &chunks->chunks[num_chunks]; 1388 - if (le32_to_cpu(chunk->type) != q_type) 1335 + chunk = &chunks->queue_chunks[num_chunks]; 1336 + if (chunk->type != q_type) 1389 1337 continue; 1390 1338 1391 - num_q = le32_to_cpu(chunk->num_queues); 1392 - reg_val = le64_to_cpu(chunk->qtail_reg_start); 1339 + num_q = chunk->num_queues; 1340 + reg_val = chunk->qtail_reg_start; 1393 1341 for (i = 0; i < num_q && reg_filled < num_regs ; i++) { 1394 1342 reg_vals[reg_filled++] = reg_val; 1395 - reg_val += le32_to_cpu(chunk->qtail_reg_spacing); 1343 + reg_val += chunk->qtail_reg_spacing; 1396 1344 } 1397 1345 } 1398 1346 ··· 1402 1350 /** 1403 1351 * __idpf_queue_reg_init - initialize queue registers 1404 1352 * @vport: virtual port structure 1353 + * @rsrc: pointer to queue and vector resources 1405 1354 * @reg_vals: registers we are initializing 1406 1355 * @num_regs: how many registers there are in total 1407 1356 * @q_type: queue model 1408 1357 * 1409 1358 * Return number of queues that are initialized 1410 1359 */ 1411 - static int __idpf_queue_reg_init(struct idpf_vport *vport, u32 *reg_vals, 1360 + static int __idpf_queue_reg_init(struct idpf_vport *vport, 1361 + struct idpf_q_vec_rsrc *rsrc, u32 *reg_vals, 1412 1362 int num_regs, u32 q_type) 1413 1363 { 1414 1364 struct idpf_adapter *adapter = vport->adapter; ··· 1418 1364 1419 1365 switch (q_type) { 1420 1366 case VIRTCHNL2_QUEUE_TYPE_TX: 1421 - for (i = 0; i < vport->num_txq_grp; i++) { 1422 - struct idpf_txq_group *tx_qgrp = &vport->txq_grps[i]; 1367 + for (i = 0; i < rsrc->num_txq_grp; i++) { 1368 + struct idpf_txq_group *tx_qgrp = &rsrc->txq_grps[i]; 1423 1369 1424 1370 for (j = 0; j < tx_qgrp->num_txq && k < num_regs; j++, k++) 1425 1371 tx_qgrp->txqs[j]->tail = ··· 1427 1373 } 1428 1374 break; 1429 1375 case VIRTCHNL2_QUEUE_TYPE_RX: 1430 - for (i = 0; i < vport->num_rxq_grp; i++) { 1431 - struct idpf_rxq_group *rx_qgrp = &vport->rxq_grps[i]; 1376 + for (i = 0; i < rsrc->num_rxq_grp; i++) { 1377 + struct idpf_rxq_group *rx_qgrp = &rsrc->rxq_grps[i]; 1432 1378 u16 num_rxq = rx_qgrp->singleq.num_rxq; 1433 1379 1434 1380 for (j = 0; j < num_rxq && k < num_regs; j++, k++) { ··· 1441 1387 } 1442 1388 break; 1443 1389 case VIRTCHNL2_QUEUE_TYPE_RX_BUFFER: 1444 - for (i = 0; i < vport->num_rxq_grp; i++) { 1445 - struct idpf_rxq_group *rx_qgrp = &vport->rxq_grps[i]; 1446 - u8 num_bufqs = vport->num_bufqs_per_qgrp; 1390 + for (i = 0; i < rsrc->num_rxq_grp; i++) { 1391 + struct idpf_rxq_group *rx_qgrp = &rsrc->rxq_grps[i]; 1392 + u8 num_bufqs = rsrc->num_bufqs_per_qgrp; 1447 1393 1448 1394 for (j = 0; j < num_bufqs && k < num_regs; j++, k++) { 1449 1395 struct idpf_buf_queue *q; ··· 1464 1410 /** 1465 1411 * idpf_queue_reg_init - initialize queue registers 1466 1412 * @vport: virtual port structure 1413 + * @rsrc: pointer to queue and vector resources 1414 + * @chunks: queue registers received over mailbox 1467 1415 * 1468 - * Return 0 on success, negative on failure 1416 + * Return: 0 on success, negative on failure 1469 1417 */ 1470 - int idpf_queue_reg_init(struct idpf_vport *vport) 1418 + int idpf_queue_reg_init(struct idpf_vport *vport, 1419 + struct idpf_q_vec_rsrc *rsrc, 1420 + struct idpf_queue_id_reg_info *chunks) 1471 1421 { 1472 - struct virtchnl2_create_vport *vport_params; 1473 - struct virtchnl2_queue_reg_chunks *chunks; 1474 - struct idpf_vport_config *vport_config; 1475 - u16 vport_idx = vport->idx; 1476 1422 int num_regs, ret = 0; 1477 1423 u32 *reg_vals; 1478 1424 ··· 1481 1427 if (!reg_vals) 1482 1428 return -ENOMEM; 1483 1429 1484 - vport_config = vport->adapter->vport_config[vport_idx]; 1485 - if (vport_config->req_qs_chunks) { 1486 - struct virtchnl2_add_queues *vc_aq = 1487 - (struct virtchnl2_add_queues *)vport_config->req_qs_chunks; 1488 - chunks = &vc_aq->chunks; 1489 - } else { 1490 - vport_params = vport->adapter->vport_params_recvd[vport_idx]; 1491 - chunks = &vport_params->chunks; 1492 - } 1493 - 1494 1430 /* Initialize Tx queue tail register address */ 1495 1431 num_regs = idpf_vport_get_q_reg(reg_vals, IDPF_LARGE_MAX_Q, 1496 1432 VIRTCHNL2_QUEUE_TYPE_TX, 1497 1433 chunks); 1498 - if (num_regs < vport->num_txq) { 1434 + if (num_regs < rsrc->num_txq) { 1499 1435 ret = -EINVAL; 1500 1436 goto free_reg_vals; 1501 1437 } 1502 1438 1503 - num_regs = __idpf_queue_reg_init(vport, reg_vals, num_regs, 1439 + num_regs = __idpf_queue_reg_init(vport, rsrc, reg_vals, num_regs, 1504 1440 VIRTCHNL2_QUEUE_TYPE_TX); 1505 - if (num_regs < vport->num_txq) { 1441 + if (num_regs < rsrc->num_txq) { 1506 1442 ret = -EINVAL; 1507 1443 goto free_reg_vals; 1508 1444 } ··· 1500 1456 /* Initialize Rx/buffer queue tail register address based on Rx queue 1501 1457 * model 1502 1458 */ 1503 - if (idpf_is_queue_model_split(vport->rxq_model)) { 1459 + if (idpf_is_queue_model_split(rsrc->rxq_model)) { 1504 1460 num_regs = idpf_vport_get_q_reg(reg_vals, IDPF_LARGE_MAX_Q, 1505 1461 VIRTCHNL2_QUEUE_TYPE_RX_BUFFER, 1506 1462 chunks); 1507 - if (num_regs < vport->num_bufq) { 1463 + if (num_regs < rsrc->num_bufq) { 1508 1464 ret = -EINVAL; 1509 1465 goto free_reg_vals; 1510 1466 } 1511 1467 1512 - num_regs = __idpf_queue_reg_init(vport, reg_vals, num_regs, 1468 + num_regs = __idpf_queue_reg_init(vport, rsrc, reg_vals, num_regs, 1513 1469 VIRTCHNL2_QUEUE_TYPE_RX_BUFFER); 1514 - if (num_regs < vport->num_bufq) { 1470 + if (num_regs < rsrc->num_bufq) { 1515 1471 ret = -EINVAL; 1516 1472 goto free_reg_vals; 1517 1473 } ··· 1519 1475 num_regs = idpf_vport_get_q_reg(reg_vals, IDPF_LARGE_MAX_Q, 1520 1476 VIRTCHNL2_QUEUE_TYPE_RX, 1521 1477 chunks); 1522 - if (num_regs < vport->num_rxq) { 1478 + if (num_regs < rsrc->num_rxq) { 1523 1479 ret = -EINVAL; 1524 1480 goto free_reg_vals; 1525 1481 } 1526 1482 1527 - num_regs = __idpf_queue_reg_init(vport, reg_vals, num_regs, 1483 + num_regs = __idpf_queue_reg_init(vport, rsrc, reg_vals, num_regs, 1528 1484 VIRTCHNL2_QUEUE_TYPE_RX); 1529 - if (num_regs < vport->num_rxq) { 1485 + if (num_regs < rsrc->num_rxq) { 1530 1486 ret = -EINVAL; 1531 1487 goto free_reg_vals; 1532 1488 } ··· 1625 1581 */ 1626 1582 int idpf_check_supported_desc_ids(struct idpf_vport *vport) 1627 1583 { 1584 + struct idpf_q_vec_rsrc *rsrc = &vport->dflt_qv_rsrc; 1628 1585 struct idpf_adapter *adapter = vport->adapter; 1629 1586 struct virtchnl2_create_vport *vport_msg; 1630 1587 u64 rx_desc_ids, tx_desc_ids; ··· 1642 1597 rx_desc_ids = le64_to_cpu(vport_msg->rx_desc_ids); 1643 1598 tx_desc_ids = le64_to_cpu(vport_msg->tx_desc_ids); 1644 1599 1645 - if (idpf_is_queue_model_split(vport->rxq_model)) { 1600 + if (idpf_is_queue_model_split(rsrc->rxq_model)) { 1646 1601 if (!(rx_desc_ids & VIRTCHNL2_RXDID_2_FLEX_SPLITQ_M)) { 1647 1602 dev_info(&adapter->pdev->dev, "Minimum RX descriptor support not provided, using the default\n"); 1648 1603 vport_msg->rx_desc_ids = cpu_to_le64(VIRTCHNL2_RXDID_2_FLEX_SPLITQ_M); 1649 1604 } 1650 1605 } else { 1651 1606 if (!(rx_desc_ids & VIRTCHNL2_RXDID_2_FLEX_SQ_NIC_M)) 1652 - vport->base_rxd = true; 1607 + rsrc->base_rxd = true; 1653 1608 } 1654 1609 1655 - if (!idpf_is_queue_model_split(vport->txq_model)) 1610 + if (!idpf_is_queue_model_split(rsrc->txq_model)) 1656 1611 return 0; 1657 1612 1658 1613 if ((tx_desc_ids & MIN_SUPPORT_TXDID) != MIN_SUPPORT_TXDID) { ··· 1665 1620 1666 1621 /** 1667 1622 * idpf_send_destroy_vport_msg - Send virtchnl destroy vport message 1668 - * @vport: virtual port data structure 1623 + * @adapter: adapter pointer used to send virtchnl message 1624 + * @vport_id: vport identifier used while preparing the virtchnl message 1669 1625 * 1670 - * Send virtchnl destroy vport message. Returns 0 on success, negative on 1671 - * failure. 1626 + * Return: 0 on success, negative on failure. 1672 1627 */ 1673 - int idpf_send_destroy_vport_msg(struct idpf_vport *vport) 1628 + int idpf_send_destroy_vport_msg(struct idpf_adapter *adapter, u32 vport_id) 1674 1629 { 1675 1630 struct idpf_vc_xn_params xn_params = {}; 1676 1631 struct virtchnl2_vport v_id; 1677 1632 ssize_t reply_sz; 1678 1633 1679 - v_id.vport_id = cpu_to_le32(vport->vport_id); 1634 + v_id.vport_id = cpu_to_le32(vport_id); 1680 1635 1681 1636 xn_params.vc_op = VIRTCHNL2_OP_DESTROY_VPORT; 1682 1637 xn_params.send_buf.iov_base = &v_id; 1683 1638 xn_params.send_buf.iov_len = sizeof(v_id); 1684 1639 xn_params.timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC; 1685 - reply_sz = idpf_vc_xn_exec(vport->adapter, &xn_params); 1640 + reply_sz = idpf_vc_xn_exec(adapter, &xn_params); 1686 1641 1687 1642 return reply_sz < 0 ? reply_sz : 0; 1688 1643 } 1689 1644 1690 1645 /** 1691 1646 * idpf_send_enable_vport_msg - Send virtchnl enable vport message 1692 - * @vport: virtual port data structure 1647 + * @adapter: adapter pointer used to send virtchnl message 1648 + * @vport_id: vport identifier used while preparing the virtchnl message 1693 1649 * 1694 - * Send enable vport virtchnl message. Returns 0 on success, negative on 1695 - * failure. 1650 + * Return: 0 on success, negative on failure. 1696 1651 */ 1697 - int idpf_send_enable_vport_msg(struct idpf_vport *vport) 1652 + int idpf_send_enable_vport_msg(struct idpf_adapter *adapter, u32 vport_id) 1698 1653 { 1699 1654 struct idpf_vc_xn_params xn_params = {}; 1700 1655 struct virtchnl2_vport v_id; 1701 1656 ssize_t reply_sz; 1702 1657 1703 - v_id.vport_id = cpu_to_le32(vport->vport_id); 1658 + v_id.vport_id = cpu_to_le32(vport_id); 1704 1659 1705 1660 xn_params.vc_op = VIRTCHNL2_OP_ENABLE_VPORT; 1706 1661 xn_params.send_buf.iov_base = &v_id; 1707 1662 xn_params.send_buf.iov_len = sizeof(v_id); 1708 1663 xn_params.timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC; 1709 - reply_sz = idpf_vc_xn_exec(vport->adapter, &xn_params); 1664 + reply_sz = idpf_vc_xn_exec(adapter, &xn_params); 1710 1665 1711 1666 return reply_sz < 0 ? reply_sz : 0; 1712 1667 } 1713 1668 1714 1669 /** 1715 1670 * idpf_send_disable_vport_msg - Send virtchnl disable vport message 1716 - * @vport: virtual port data structure 1671 + * @adapter: adapter pointer used to send virtchnl message 1672 + * @vport_id: vport identifier used while preparing the virtchnl message 1717 1673 * 1718 - * Send disable vport virtchnl message. Returns 0 on success, negative on 1719 - * failure. 1674 + * Return: 0 on success, negative on failure. 1720 1675 */ 1721 - int idpf_send_disable_vport_msg(struct idpf_vport *vport) 1676 + int idpf_send_disable_vport_msg(struct idpf_adapter *adapter, u32 vport_id) 1722 1677 { 1723 1678 struct idpf_vc_xn_params xn_params = {}; 1724 1679 struct virtchnl2_vport v_id; 1725 1680 ssize_t reply_sz; 1726 1681 1727 - v_id.vport_id = cpu_to_le32(vport->vport_id); 1682 + v_id.vport_id = cpu_to_le32(vport_id); 1728 1683 1729 1684 xn_params.vc_op = VIRTCHNL2_OP_DISABLE_VPORT; 1730 1685 xn_params.send_buf.iov_base = &v_id; 1731 1686 xn_params.send_buf.iov_len = sizeof(v_id); 1732 1687 xn_params.timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC; 1733 - reply_sz = idpf_vc_xn_exec(vport->adapter, &xn_params); 1688 + reply_sz = idpf_vc_xn_exec(adapter, &xn_params); 1734 1689 1735 1690 return reply_sz < 0 ? reply_sz : 0; 1736 1691 } 1737 1692 1738 1693 /** 1739 1694 * idpf_fill_txq_config_chunk - fill chunk describing the Tx queue 1740 - * @vport: virtual port data structure 1695 + * @rsrc: pointer to queue and vector resources 1741 1696 * @q: Tx queue to be inserted into VC chunk 1742 1697 * @qi: pointer to the buffer containing the VC chunk 1743 1698 */ 1744 - static void idpf_fill_txq_config_chunk(const struct idpf_vport *vport, 1699 + static void idpf_fill_txq_config_chunk(const struct idpf_q_vec_rsrc *rsrc, 1745 1700 const struct idpf_tx_queue *q, 1746 1701 struct virtchnl2_txq_info *qi) 1747 1702 { 1748 1703 u32 val; 1749 1704 1750 1705 qi->queue_id = cpu_to_le32(q->q_id); 1751 - qi->model = cpu_to_le16(vport->txq_model); 1706 + qi->model = cpu_to_le16(rsrc->txq_model); 1752 1707 qi->type = cpu_to_le32(VIRTCHNL2_QUEUE_TYPE_TX); 1753 1708 qi->ring_len = cpu_to_le16(q->desc_count); 1754 1709 qi->dma_ring_addr = cpu_to_le64(q->dma); 1755 1710 qi->relative_queue_id = cpu_to_le16(q->rel_q_id); 1756 1711 1757 - if (!idpf_is_queue_model_split(vport->txq_model)) { 1712 + if (!idpf_is_queue_model_split(rsrc->txq_model)) { 1758 1713 qi->sched_mode = cpu_to_le16(VIRTCHNL2_TXQ_SCHED_MODE_QUEUE); 1759 1714 return; 1760 1715 } ··· 1776 1731 1777 1732 /** 1778 1733 * idpf_fill_complq_config_chunk - fill chunk describing the completion queue 1779 - * @vport: virtual port data structure 1734 + * @rsrc: pointer to queue and vector resources 1780 1735 * @q: completion queue to be inserted into VC chunk 1781 1736 * @qi: pointer to the buffer containing the VC chunk 1782 1737 */ 1783 - static void idpf_fill_complq_config_chunk(const struct idpf_vport *vport, 1738 + static void idpf_fill_complq_config_chunk(const struct idpf_q_vec_rsrc *rsrc, 1784 1739 const struct idpf_compl_queue *q, 1785 1740 struct virtchnl2_txq_info *qi) 1786 1741 { 1787 1742 u32 val; 1788 1743 1789 1744 qi->queue_id = cpu_to_le32(q->q_id); 1790 - qi->model = cpu_to_le16(vport->txq_model); 1745 + qi->model = cpu_to_le16(rsrc->txq_model); 1791 1746 qi->type = cpu_to_le32(VIRTCHNL2_QUEUE_TYPE_TX_COMPLETION); 1792 1747 qi->ring_len = cpu_to_le16(q->desc_count); 1793 1748 qi->dma_ring_addr = cpu_to_le64(q->dma); ··· 1802 1757 1803 1758 /** 1804 1759 * idpf_prepare_cfg_txqs_msg - prepare message to configure selected Tx queues 1805 - * @vport: virtual port data structure 1760 + * @vport_id: ID of virtual port queues are associated with 1806 1761 * @buf: buffer containing the message 1807 1762 * @pos: pointer to the first chunk describing the tx queue 1808 1763 * @num_chunks: number of chunks in the message ··· 1812 1767 * 1813 1768 * Return: the total size of the prepared message. 1814 1769 */ 1815 - static u32 idpf_prepare_cfg_txqs_msg(const struct idpf_vport *vport, 1816 - void *buf, const void *pos, 1770 + static u32 idpf_prepare_cfg_txqs_msg(u32 vport_id, void *buf, const void *pos, 1817 1771 u32 num_chunks) 1818 1772 { 1819 1773 struct virtchnl2_config_tx_queues *ctq = buf; 1820 1774 1821 - ctq->vport_id = cpu_to_le32(vport->vport_id); 1775 + ctq->vport_id = cpu_to_le32(vport_id); 1822 1776 ctq->num_qinfo = cpu_to_le16(num_chunks); 1823 1777 memcpy(ctq->qinfo, pos, num_chunks * sizeof(*ctq->qinfo)); 1824 1778 ··· 1838 1794 { 1839 1795 struct virtchnl2_txq_info *qi __free(kfree) = NULL; 1840 1796 struct idpf_chunked_msg_params params = { 1797 + .vport_id = qs->vport_id, 1841 1798 .vc_op = VIRTCHNL2_OP_CONFIG_TX_QUEUES, 1842 1799 .prepare_msg = idpf_prepare_cfg_txqs_msg, 1843 1800 .config_sz = sizeof(struct virtchnl2_config_tx_queues), ··· 1853 1808 1854 1809 for (u32 i = 0; i < qs->num; i++) { 1855 1810 if (qs->qs[i].type == VIRTCHNL2_QUEUE_TYPE_TX) 1856 - idpf_fill_txq_config_chunk(qs->vport, qs->qs[i].txq, 1811 + idpf_fill_txq_config_chunk(qs->qv_rsrc, qs->qs[i].txq, 1857 1812 &qi[params.num_chunks++]); 1858 1813 else if (qs->qs[i].type == VIRTCHNL2_QUEUE_TYPE_TX_COMPLETION) 1859 - idpf_fill_complq_config_chunk(qs->vport, 1814 + idpf_fill_complq_config_chunk(qs->qv_rsrc, 1860 1815 qs->qs[i].complq, 1861 1816 &qi[params.num_chunks++]); 1862 1817 } 1863 1818 1864 - return idpf_send_chunked_msg(qs->vport, &params); 1819 + return idpf_send_chunked_msg(qs->adapter, &params); 1865 1820 } 1866 1821 1867 1822 /** 1868 1823 * idpf_send_config_tx_queues_msg - send virtchnl config Tx queues message 1869 - * @vport: virtual port data structure 1824 + * @adapter: adapter pointer used to send virtchnl message 1825 + * @rsrc: pointer to queue and vector resources 1826 + * @vport_id: vport identifier used while preparing the virtchnl message 1870 1827 * 1871 1828 * Return: 0 on success, -errno on failure. 1872 1829 */ 1873 - static int idpf_send_config_tx_queues_msg(struct idpf_vport *vport) 1830 + static int idpf_send_config_tx_queues_msg(struct idpf_adapter *adapter, 1831 + struct idpf_q_vec_rsrc *rsrc, 1832 + u32 vport_id) 1874 1833 { 1875 1834 struct idpf_queue_set *qs __free(kfree) = NULL; 1876 - u32 totqs = vport->num_txq + vport->num_complq; 1835 + u32 totqs = rsrc->num_txq + rsrc->num_complq; 1877 1836 u32 k = 0; 1878 1837 1879 - qs = idpf_alloc_queue_set(vport, totqs); 1838 + qs = idpf_alloc_queue_set(adapter, rsrc, vport_id, totqs); 1880 1839 if (!qs) 1881 1840 return -ENOMEM; 1882 1841 1883 1842 /* Populate the queue info buffer with all queue context info */ 1884 - for (u32 i = 0; i < vport->num_txq_grp; i++) { 1885 - const struct idpf_txq_group *tx_qgrp = &vport->txq_grps[i]; 1843 + for (u32 i = 0; i < rsrc->num_txq_grp; i++) { 1844 + const struct idpf_txq_group *tx_qgrp = &rsrc->txq_grps[i]; 1886 1845 1887 1846 for (u32 j = 0; j < tx_qgrp->num_txq; j++) { 1888 1847 qs->qs[k].type = VIRTCHNL2_QUEUE_TYPE_TX; 1889 1848 qs->qs[k++].txq = tx_qgrp->txqs[j]; 1890 1849 } 1891 1850 1892 - if (idpf_is_queue_model_split(vport->txq_model)) { 1851 + if (idpf_is_queue_model_split(rsrc->txq_model)) { 1893 1852 qs->qs[k].type = VIRTCHNL2_QUEUE_TYPE_TX_COMPLETION; 1894 1853 qs->qs[k++].complq = tx_qgrp->complq; 1895 1854 } ··· 1908 1859 1909 1860 /** 1910 1861 * idpf_fill_rxq_config_chunk - fill chunk describing the Rx queue 1911 - * @vport: virtual port data structure 1862 + * @rsrc: pointer to queue and vector resources 1912 1863 * @q: Rx queue to be inserted into VC chunk 1913 1864 * @qi: pointer to the buffer containing the VC chunk 1914 1865 */ 1915 - static void idpf_fill_rxq_config_chunk(const struct idpf_vport *vport, 1866 + static void idpf_fill_rxq_config_chunk(const struct idpf_q_vec_rsrc *rsrc, 1916 1867 struct idpf_rx_queue *q, 1917 1868 struct virtchnl2_rxq_info *qi) 1918 1869 { 1919 1870 const struct idpf_bufq_set *sets; 1920 1871 1921 1872 qi->queue_id = cpu_to_le32(q->q_id); 1922 - qi->model = cpu_to_le16(vport->rxq_model); 1873 + qi->model = cpu_to_le16(rsrc->rxq_model); 1923 1874 qi->type = cpu_to_le32(VIRTCHNL2_QUEUE_TYPE_RX); 1924 1875 qi->ring_len = cpu_to_le16(q->desc_count); 1925 1876 qi->dma_ring_addr = cpu_to_le64(q->dma); 1926 1877 qi->max_pkt_size = cpu_to_le32(q->rx_max_pkt_size); 1927 1878 qi->rx_buffer_low_watermark = cpu_to_le16(q->rx_buffer_low_watermark); 1928 1879 qi->qflags = cpu_to_le16(VIRTCHNL2_RX_DESC_SIZE_32BYTE); 1929 - if (idpf_is_feature_ena(vport, NETIF_F_GRO_HW)) 1880 + if (idpf_queue_has(RSC_EN, q)) 1930 1881 qi->qflags |= cpu_to_le16(VIRTCHNL2_RXQ_RSC); 1931 1882 1932 - if (!idpf_is_queue_model_split(vport->rxq_model)) { 1883 + if (!idpf_is_queue_model_split(rsrc->rxq_model)) { 1933 1884 qi->data_buffer_size = cpu_to_le32(q->rx_buf_size); 1934 1885 qi->desc_ids = cpu_to_le64(q->rxdids); 1935 1886 ··· 1946 1897 qi->data_buffer_size = cpu_to_le32(q->rx_buf_size); 1947 1898 1948 1899 qi->rx_bufq1_id = cpu_to_le16(sets[0].bufq.q_id); 1949 - if (vport->num_bufqs_per_qgrp > IDPF_SINGLE_BUFQ_PER_RXQ_GRP) { 1900 + if (rsrc->num_bufqs_per_qgrp > IDPF_SINGLE_BUFQ_PER_RXQ_GRP) { 1950 1901 qi->bufq2_ena = IDPF_BUFQ2_ENA; 1951 1902 qi->rx_bufq2_id = cpu_to_le16(sets[1].bufq.q_id); 1952 1903 } ··· 1963 1914 1964 1915 /** 1965 1916 * idpf_fill_bufq_config_chunk - fill chunk describing the buffer queue 1966 - * @vport: virtual port data structure 1917 + * @rsrc: pointer to queue and vector resources 1967 1918 * @q: buffer queue to be inserted into VC chunk 1968 1919 * @qi: pointer to the buffer containing the VC chunk 1969 1920 */ 1970 - static void idpf_fill_bufq_config_chunk(const struct idpf_vport *vport, 1921 + static void idpf_fill_bufq_config_chunk(const struct idpf_q_vec_rsrc *rsrc, 1971 1922 const struct idpf_buf_queue *q, 1972 1923 struct virtchnl2_rxq_info *qi) 1973 1924 { 1974 1925 qi->queue_id = cpu_to_le32(q->q_id); 1975 - qi->model = cpu_to_le16(vport->rxq_model); 1926 + qi->model = cpu_to_le16(rsrc->rxq_model); 1976 1927 qi->type = cpu_to_le32(VIRTCHNL2_QUEUE_TYPE_RX_BUFFER); 1977 1928 qi->ring_len = cpu_to_le16(q->desc_count); 1978 1929 qi->dma_ring_addr = cpu_to_le64(q->dma); ··· 1980 1931 qi->rx_buffer_low_watermark = cpu_to_le16(q->rx_buffer_low_watermark); 1981 1932 qi->desc_ids = cpu_to_le64(VIRTCHNL2_RXDID_2_FLEX_SPLITQ_M); 1982 1933 qi->buffer_notif_stride = IDPF_RX_BUF_STRIDE; 1983 - if (idpf_is_feature_ena(vport, NETIF_F_GRO_HW)) 1934 + if (idpf_queue_has(RSC_EN, q)) 1984 1935 qi->qflags = cpu_to_le16(VIRTCHNL2_RXQ_RSC); 1985 1936 1986 1937 if (idpf_queue_has(HSPLIT_EN, q)) { ··· 1991 1942 1992 1943 /** 1993 1944 * idpf_prepare_cfg_rxqs_msg - prepare message to configure selected Rx queues 1994 - * @vport: virtual port data structure 1945 + * @vport_id: ID of virtual port queues are associated with 1995 1946 * @buf: buffer containing the message 1996 1947 * @pos: pointer to the first chunk describing the rx queue 1997 1948 * @num_chunks: number of chunks in the message ··· 2001 1952 * 2002 1953 * Return: the total size of the prepared message. 2003 1954 */ 2004 - static u32 idpf_prepare_cfg_rxqs_msg(const struct idpf_vport *vport, 2005 - void *buf, const void *pos, 1955 + static u32 idpf_prepare_cfg_rxqs_msg(u32 vport_id, void *buf, const void *pos, 2006 1956 u32 num_chunks) 2007 1957 { 2008 1958 struct virtchnl2_config_rx_queues *crq = buf; 2009 1959 2010 - crq->vport_id = cpu_to_le32(vport->vport_id); 1960 + crq->vport_id = cpu_to_le32(vport_id); 2011 1961 crq->num_qinfo = cpu_to_le16(num_chunks); 2012 1962 memcpy(crq->qinfo, pos, num_chunks * sizeof(*crq->qinfo)); 2013 1963 ··· 2027 1979 { 2028 1980 struct virtchnl2_rxq_info *qi __free(kfree) = NULL; 2029 1981 struct idpf_chunked_msg_params params = { 1982 + .vport_id = qs->vport_id, 2030 1983 .vc_op = VIRTCHNL2_OP_CONFIG_RX_QUEUES, 2031 1984 .prepare_msg = idpf_prepare_cfg_rxqs_msg, 2032 1985 .config_sz = sizeof(struct virtchnl2_config_rx_queues), ··· 2042 1993 2043 1994 for (u32 i = 0; i < qs->num; i++) { 2044 1995 if (qs->qs[i].type == VIRTCHNL2_QUEUE_TYPE_RX) 2045 - idpf_fill_rxq_config_chunk(qs->vport, qs->qs[i].rxq, 1996 + idpf_fill_rxq_config_chunk(qs->qv_rsrc, qs->qs[i].rxq, 2046 1997 &qi[params.num_chunks++]); 2047 1998 else if (qs->qs[i].type == VIRTCHNL2_QUEUE_TYPE_RX_BUFFER) 2048 - idpf_fill_bufq_config_chunk(qs->vport, qs->qs[i].bufq, 1999 + idpf_fill_bufq_config_chunk(qs->qv_rsrc, qs->qs[i].bufq, 2049 2000 &qi[params.num_chunks++]); 2050 2001 } 2051 2002 2052 - return idpf_send_chunked_msg(qs->vport, &params); 2003 + return idpf_send_chunked_msg(qs->adapter, &params); 2053 2004 } 2054 2005 2055 2006 /** 2056 2007 * idpf_send_config_rx_queues_msg - send virtchnl config Rx queues message 2057 - * @vport: virtual port data structure 2008 + * @adapter: adapter pointer used to send virtchnl message 2009 + * @rsrc: pointer to queue and vector resources 2010 + * @vport_id: vport identifier used while preparing the virtchnl message 2058 2011 * 2059 2012 * Return: 0 on success, -errno on failure. 2060 2013 */ 2061 - static int idpf_send_config_rx_queues_msg(struct idpf_vport *vport) 2014 + static int idpf_send_config_rx_queues_msg(struct idpf_adapter *adapter, 2015 + struct idpf_q_vec_rsrc *rsrc, 2016 + u32 vport_id) 2062 2017 { 2063 - bool splitq = idpf_is_queue_model_split(vport->rxq_model); 2018 + bool splitq = idpf_is_queue_model_split(rsrc->rxq_model); 2064 2019 struct idpf_queue_set *qs __free(kfree) = NULL; 2065 - u32 totqs = vport->num_rxq + vport->num_bufq; 2020 + u32 totqs = rsrc->num_rxq + rsrc->num_bufq; 2066 2021 u32 k = 0; 2067 2022 2068 - qs = idpf_alloc_queue_set(vport, totqs); 2023 + qs = idpf_alloc_queue_set(adapter, rsrc, vport_id, totqs); 2069 2024 if (!qs) 2070 2025 return -ENOMEM; 2071 2026 2072 2027 /* Populate the queue info buffer with all queue context info */ 2073 - for (u32 i = 0; i < vport->num_rxq_grp; i++) { 2074 - const struct idpf_rxq_group *rx_qgrp = &vport->rxq_grps[i]; 2028 + for (u32 i = 0; i < rsrc->num_rxq_grp; i++) { 2029 + const struct idpf_rxq_group *rx_qgrp = &rsrc->rxq_grps[i]; 2075 2030 u32 num_rxq; 2076 2031 2077 2032 if (!splitq) { ··· 2083 2030 goto rxq; 2084 2031 } 2085 2032 2086 - for (u32 j = 0; j < vport->num_bufqs_per_qgrp; j++) { 2033 + for (u32 j = 0; j < rsrc->num_bufqs_per_qgrp; j++) { 2087 2034 qs->qs[k].type = VIRTCHNL2_QUEUE_TYPE_RX_BUFFER; 2088 2035 qs->qs[k++].bufq = &rx_qgrp->splitq.bufq_sets[j].bufq; 2089 2036 } ··· 2112 2059 /** 2113 2060 * idpf_prepare_ena_dis_qs_msg - prepare message to enable/disable selected 2114 2061 * queues 2115 - * @vport: virtual port data structure 2062 + * @vport_id: ID of virtual port queues are associated with 2116 2063 * @buf: buffer containing the message 2117 2064 * @pos: pointer to the first chunk describing the queue 2118 2065 * @num_chunks: number of chunks in the message ··· 2122 2069 * 2123 2070 * Return: the total size of the prepared message. 2124 2071 */ 2125 - static u32 idpf_prepare_ena_dis_qs_msg(const struct idpf_vport *vport, 2126 - void *buf, const void *pos, 2072 + static u32 idpf_prepare_ena_dis_qs_msg(u32 vport_id, void *buf, const void *pos, 2127 2073 u32 num_chunks) 2128 2074 { 2129 2075 struct virtchnl2_del_ena_dis_queues *eq = buf; 2130 2076 2131 - eq->vport_id = cpu_to_le32(vport->vport_id); 2077 + eq->vport_id = cpu_to_le32(vport_id); 2132 2078 eq->chunks.num_chunks = cpu_to_le16(num_chunks); 2133 2079 memcpy(eq->chunks.chunks, pos, 2134 2080 num_chunks * sizeof(*eq->chunks.chunks)); ··· 2152 2100 { 2153 2101 struct virtchnl2_queue_chunk *qc __free(kfree) = NULL; 2154 2102 struct idpf_chunked_msg_params params = { 2103 + .vport_id = qs->vport_id, 2155 2104 .vc_op = en ? VIRTCHNL2_OP_ENABLE_QUEUES : 2156 2105 VIRTCHNL2_OP_DISABLE_QUEUES, 2157 2106 .prepare_msg = idpf_prepare_ena_dis_qs_msg, ··· 2194 2141 qc[i].start_queue_id = cpu_to_le32(qid); 2195 2142 } 2196 2143 2197 - return idpf_send_chunked_msg(qs->vport, &params); 2144 + return idpf_send_chunked_msg(qs->adapter, &params); 2198 2145 } 2199 2146 2200 2147 /** 2201 2148 * idpf_send_ena_dis_queues_msg - send virtchnl enable or disable queues 2202 2149 * message 2203 - * @vport: virtual port data structure 2150 + * @adapter: adapter pointer used to send virtchnl message 2151 + * @rsrc: pointer to queue and vector resources 2152 + * @vport_id: vport identifier used while preparing the virtchnl message 2204 2153 * @en: whether to enable or disable queues 2205 2154 * 2206 2155 * Return: 0 on success, -errno on failure. 2207 2156 */ 2208 - static int idpf_send_ena_dis_queues_msg(struct idpf_vport *vport, bool en) 2157 + static int idpf_send_ena_dis_queues_msg(struct idpf_adapter *adapter, 2158 + struct idpf_q_vec_rsrc *rsrc, 2159 + u32 vport_id, bool en) 2209 2160 { 2210 2161 struct idpf_queue_set *qs __free(kfree) = NULL; 2211 2162 u32 num_txq, num_q, k = 0; 2212 2163 bool split; 2213 2164 2214 - num_txq = vport->num_txq + vport->num_complq; 2215 - num_q = num_txq + vport->num_rxq + vport->num_bufq; 2165 + num_txq = rsrc->num_txq + rsrc->num_complq; 2166 + num_q = num_txq + rsrc->num_rxq + rsrc->num_bufq; 2216 2167 2217 - qs = idpf_alloc_queue_set(vport, num_q); 2168 + qs = idpf_alloc_queue_set(adapter, rsrc, vport_id, num_q); 2218 2169 if (!qs) 2219 2170 return -ENOMEM; 2220 2171 2221 - split = idpf_is_queue_model_split(vport->txq_model); 2172 + split = idpf_is_queue_model_split(rsrc->txq_model); 2222 2173 2223 - for (u32 i = 0; i < vport->num_txq_grp; i++) { 2224 - const struct idpf_txq_group *tx_qgrp = &vport->txq_grps[i]; 2174 + for (u32 i = 0; i < rsrc->num_txq_grp; i++) { 2175 + const struct idpf_txq_group *tx_qgrp = &rsrc->txq_grps[i]; 2225 2176 2226 2177 for (u32 j = 0; j < tx_qgrp->num_txq; j++) { 2227 2178 qs->qs[k].type = VIRTCHNL2_QUEUE_TYPE_TX; ··· 2242 2185 if (k != num_txq) 2243 2186 return -EINVAL; 2244 2187 2245 - split = idpf_is_queue_model_split(vport->rxq_model); 2188 + split = idpf_is_queue_model_split(rsrc->rxq_model); 2246 2189 2247 - for (u32 i = 0; i < vport->num_rxq_grp; i++) { 2248 - const struct idpf_rxq_group *rx_qgrp = &vport->rxq_grps[i]; 2190 + for (u32 i = 0; i < rsrc->num_rxq_grp; i++) { 2191 + const struct idpf_rxq_group *rx_qgrp = &rsrc->rxq_grps[i]; 2249 2192 u32 num_rxq; 2250 2193 2251 2194 if (split) ··· 2266 2209 if (!split) 2267 2210 continue; 2268 2211 2269 - for (u32 j = 0; j < vport->num_bufqs_per_qgrp; j++) { 2212 + for (u32 j = 0; j < rsrc->num_bufqs_per_qgrp; j++) { 2270 2213 qs->qs[k].type = VIRTCHNL2_QUEUE_TYPE_RX_BUFFER; 2271 2214 qs->qs[k++].bufq = &rx_qgrp->splitq.bufq_sets[j].bufq; 2272 2215 } ··· 2281 2224 /** 2282 2225 * idpf_prep_map_unmap_queue_set_vector_msg - prepare message to map or unmap 2283 2226 * queue set to the interrupt vector 2284 - * @vport: virtual port data structure 2227 + * @vport_id: ID of virtual port queues are associated with 2285 2228 * @buf: buffer containing the message 2286 2229 * @pos: pointer to the first chunk describing the vector mapping 2287 2230 * @num_chunks: number of chunks in the message ··· 2292 2235 * Return: the total size of the prepared message. 2293 2236 */ 2294 2237 static u32 2295 - idpf_prep_map_unmap_queue_set_vector_msg(const struct idpf_vport *vport, 2296 - void *buf, const void *pos, 2297 - u32 num_chunks) 2238 + idpf_prep_map_unmap_queue_set_vector_msg(u32 vport_id, void *buf, 2239 + const void *pos, u32 num_chunks) 2298 2240 { 2299 2241 struct virtchnl2_queue_vector_maps *vqvm = buf; 2300 2242 2301 - vqvm->vport_id = cpu_to_le32(vport->vport_id); 2243 + vqvm->vport_id = cpu_to_le32(vport_id); 2302 2244 vqvm->num_qv_maps = cpu_to_le16(num_chunks); 2303 2245 memcpy(vqvm->qv_maps, pos, num_chunks * sizeof(*vqvm->qv_maps)); 2304 2246 ··· 2318 2262 { 2319 2263 struct virtchnl2_queue_vector *vqv __free(kfree) = NULL; 2320 2264 struct idpf_chunked_msg_params params = { 2265 + .vport_id = qs->vport_id, 2321 2266 .vc_op = map ? VIRTCHNL2_OP_MAP_QUEUE_VECTOR : 2322 2267 VIRTCHNL2_OP_UNMAP_QUEUE_VECTOR, 2323 2268 .prepare_msg = idpf_prep_map_unmap_queue_set_vector_msg, ··· 2334 2277 2335 2278 params.chunks = vqv; 2336 2279 2337 - split = idpf_is_queue_model_split(qs->vport->txq_model); 2280 + split = idpf_is_queue_model_split(qs->qv_rsrc->txq_model); 2338 2281 2339 2282 for (u32 i = 0; i < qs->num; i++) { 2340 2283 const struct idpf_queue_ptr *q = &qs->qs[i]; ··· 2356 2299 v_idx = vec->v_idx; 2357 2300 itr_idx = vec->rx_itr_idx; 2358 2301 } else { 2359 - v_idx = qs->vport->noirq_v_idx; 2302 + v_idx = qs->qv_rsrc->noirq_v_idx; 2360 2303 itr_idx = VIRTCHNL2_ITR_IDX_0; 2361 2304 } 2362 2305 break; ··· 2376 2319 v_idx = vec->v_idx; 2377 2320 itr_idx = vec->tx_itr_idx; 2378 2321 } else { 2379 - v_idx = qs->vport->noirq_v_idx; 2322 + v_idx = qs->qv_rsrc->noirq_v_idx; 2380 2323 itr_idx = VIRTCHNL2_ITR_IDX_1; 2381 2324 } 2382 2325 break; ··· 2389 2332 vqv[i].itr_idx = cpu_to_le32(itr_idx); 2390 2333 } 2391 2334 2392 - return idpf_send_chunked_msg(qs->vport, &params); 2335 + return idpf_send_chunked_msg(qs->adapter, &params); 2393 2336 } 2394 2337 2395 2338 /** 2396 2339 * idpf_send_map_unmap_queue_vector_msg - send virtchnl map or unmap queue 2397 2340 * vector message 2398 - * @vport: virtual port data structure 2341 + * @adapter: adapter pointer used to send virtchnl message 2342 + * @rsrc: pointer to queue and vector resources 2343 + * @vport_id: vport identifier used while preparing the virtchnl message 2399 2344 * @map: true for map and false for unmap 2400 2345 * 2401 2346 * Return: 0 on success, -errno on failure. 2402 2347 */ 2403 - int idpf_send_map_unmap_queue_vector_msg(struct idpf_vport *vport, bool map) 2348 + int idpf_send_map_unmap_queue_vector_msg(struct idpf_adapter *adapter, 2349 + struct idpf_q_vec_rsrc *rsrc, 2350 + u32 vport_id, bool map) 2404 2351 { 2405 2352 struct idpf_queue_set *qs __free(kfree) = NULL; 2406 - u32 num_q = vport->num_txq + vport->num_rxq; 2353 + u32 num_q = rsrc->num_txq + rsrc->num_rxq; 2407 2354 u32 k = 0; 2408 2355 2409 - qs = idpf_alloc_queue_set(vport, num_q); 2356 + qs = idpf_alloc_queue_set(adapter, rsrc, vport_id, num_q); 2410 2357 if (!qs) 2411 2358 return -ENOMEM; 2412 2359 2413 - for (u32 i = 0; i < vport->num_txq_grp; i++) { 2414 - const struct idpf_txq_group *tx_qgrp = &vport->txq_grps[i]; 2360 + for (u32 i = 0; i < rsrc->num_txq_grp; i++) { 2361 + const struct idpf_txq_group *tx_qgrp = &rsrc->txq_grps[i]; 2415 2362 2416 2363 for (u32 j = 0; j < tx_qgrp->num_txq; j++) { 2417 2364 qs->qs[k].type = VIRTCHNL2_QUEUE_TYPE_TX; ··· 2423 2362 } 2424 2363 } 2425 2364 2426 - if (k != vport->num_txq) 2365 + if (k != rsrc->num_txq) 2427 2366 return -EINVAL; 2428 2367 2429 - for (u32 i = 0; i < vport->num_rxq_grp; i++) { 2430 - const struct idpf_rxq_group *rx_qgrp = &vport->rxq_grps[i]; 2368 + for (u32 i = 0; i < rsrc->num_rxq_grp; i++) { 2369 + const struct idpf_rxq_group *rx_qgrp = &rsrc->rxq_grps[i]; 2431 2370 u32 num_rxq; 2432 2371 2433 - if (idpf_is_queue_model_split(vport->rxq_model)) 2372 + if (idpf_is_queue_model_split(rsrc->rxq_model)) 2434 2373 num_rxq = rx_qgrp->splitq.num_rxq_sets; 2435 2374 else 2436 2375 num_rxq = rx_qgrp->singleq.num_rxq; ··· 2438 2377 for (u32 j = 0; j < num_rxq; j++) { 2439 2378 qs->qs[k].type = VIRTCHNL2_QUEUE_TYPE_RX; 2440 2379 2441 - if (idpf_is_queue_model_split(vport->rxq_model)) 2380 + if (idpf_is_queue_model_split(rsrc->rxq_model)) 2442 2381 qs->qs[k++].rxq = 2443 2382 &rx_qgrp->splitq.rxq_sets[j]->rxq; 2444 2383 else ··· 2514 2453 */ 2515 2454 int idpf_send_enable_queues_msg(struct idpf_vport *vport) 2516 2455 { 2517 - return idpf_send_ena_dis_queues_msg(vport, true); 2456 + return idpf_send_ena_dis_queues_msg(vport->adapter, 2457 + &vport->dflt_qv_rsrc, 2458 + vport->vport_id, true); 2518 2459 } 2519 2460 2520 2461 /** ··· 2530 2467 { 2531 2468 int err; 2532 2469 2533 - err = idpf_send_ena_dis_queues_msg(vport, false); 2470 + err = idpf_send_ena_dis_queues_msg(vport->adapter, 2471 + &vport->dflt_qv_rsrc, 2472 + vport->vport_id, false); 2534 2473 if (err) 2535 2474 return err; 2536 2475 ··· 2547 2482 * @num_chunks: number of chunks to copy 2548 2483 */ 2549 2484 static void idpf_convert_reg_to_queue_chunks(struct virtchnl2_queue_chunk *dchunks, 2550 - struct virtchnl2_queue_reg_chunk *schunks, 2485 + struct idpf_queue_id_reg_chunk *schunks, 2551 2486 u16 num_chunks) 2552 2487 { 2553 2488 u16 i; 2554 2489 2555 2490 for (i = 0; i < num_chunks; i++) { 2556 - dchunks[i].type = schunks[i].type; 2557 - dchunks[i].start_queue_id = schunks[i].start_queue_id; 2558 - dchunks[i].num_queues = schunks[i].num_queues; 2491 + dchunks[i].type = cpu_to_le32(schunks[i].type); 2492 + dchunks[i].start_queue_id = cpu_to_le32(schunks[i].start_queue_id); 2493 + dchunks[i].num_queues = cpu_to_le32(schunks[i].num_queues); 2559 2494 } 2560 2495 } 2561 2496 2562 2497 /** 2563 2498 * idpf_send_delete_queues_msg - send delete queues virtchnl message 2564 - * @vport: Virtual port private data structure 2499 + * @adapter: adapter pointer used to send virtchnl message 2500 + * @chunks: queue ids received over mailbox 2501 + * @vport_id: vport identifier used while preparing the virtchnl message 2565 2502 * 2566 - * Will send delete queues virtchnl message. Return 0 on success, negative on 2567 - * failure. 2503 + * Return: 0 on success, negative on failure. 2568 2504 */ 2569 - int idpf_send_delete_queues_msg(struct idpf_vport *vport) 2505 + int idpf_send_delete_queues_msg(struct idpf_adapter *adapter, 2506 + struct idpf_queue_id_reg_info *chunks, 2507 + u32 vport_id) 2570 2508 { 2571 2509 struct virtchnl2_del_ena_dis_queues *eq __free(kfree) = NULL; 2572 - struct virtchnl2_create_vport *vport_params; 2573 - struct virtchnl2_queue_reg_chunks *chunks; 2574 2510 struct idpf_vc_xn_params xn_params = {}; 2575 - struct idpf_vport_config *vport_config; 2576 - u16 vport_idx = vport->idx; 2577 2511 ssize_t reply_sz; 2578 2512 u16 num_chunks; 2579 2513 int buf_size; 2580 2514 2581 - vport_config = vport->adapter->vport_config[vport_idx]; 2582 - if (vport_config->req_qs_chunks) { 2583 - chunks = &vport_config->req_qs_chunks->chunks; 2584 - } else { 2585 - vport_params = vport->adapter->vport_params_recvd[vport_idx]; 2586 - chunks = &vport_params->chunks; 2587 - } 2588 - 2589 - num_chunks = le16_to_cpu(chunks->num_chunks); 2515 + num_chunks = chunks->num_chunks; 2590 2516 buf_size = struct_size(eq, chunks.chunks, num_chunks); 2591 2517 2592 2518 eq = kzalloc(buf_size, GFP_KERNEL); 2593 2519 if (!eq) 2594 2520 return -ENOMEM; 2595 2521 2596 - eq->vport_id = cpu_to_le32(vport->vport_id); 2522 + eq->vport_id = cpu_to_le32(vport_id); 2597 2523 eq->chunks.num_chunks = cpu_to_le16(num_chunks); 2598 2524 2599 - idpf_convert_reg_to_queue_chunks(eq->chunks.chunks, chunks->chunks, 2525 + idpf_convert_reg_to_queue_chunks(eq->chunks.chunks, chunks->queue_chunks, 2600 2526 num_chunks); 2601 2527 2602 2528 xn_params.vc_op = VIRTCHNL2_OP_DEL_QUEUES; 2603 2529 xn_params.timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC; 2604 2530 xn_params.send_buf.iov_base = eq; 2605 2531 xn_params.send_buf.iov_len = buf_size; 2606 - reply_sz = idpf_vc_xn_exec(vport->adapter, &xn_params); 2532 + reply_sz = idpf_vc_xn_exec(adapter, &xn_params); 2607 2533 2608 2534 return reply_sz < 0 ? reply_sz : 0; 2609 2535 } 2610 2536 2611 2537 /** 2612 2538 * idpf_send_config_queues_msg - Send config queues virtchnl message 2613 - * @vport: Virtual port private data structure 2539 + * @adapter: adapter pointer used to send virtchnl message 2540 + * @rsrc: pointer to queue and vector resources 2541 + * @vport_id: vport identifier used while preparing the virtchnl message 2614 2542 * 2615 - * Will send config queues virtchnl message. Returns 0 on success, negative on 2616 - * failure. 2543 + * Return: 0 on success, negative on failure. 2617 2544 */ 2618 - int idpf_send_config_queues_msg(struct idpf_vport *vport) 2545 + int idpf_send_config_queues_msg(struct idpf_adapter *adapter, 2546 + struct idpf_q_vec_rsrc *rsrc, 2547 + u32 vport_id) 2619 2548 { 2620 2549 int err; 2621 2550 2622 - err = idpf_send_config_tx_queues_msg(vport); 2551 + err = idpf_send_config_tx_queues_msg(adapter, rsrc, vport_id); 2623 2552 if (err) 2624 2553 return err; 2625 2554 2626 - return idpf_send_config_rx_queues_msg(vport); 2555 + return idpf_send_config_rx_queues_msg(adapter, rsrc, vport_id); 2627 2556 } 2628 2557 2629 2558 /** 2630 2559 * idpf_send_add_queues_msg - Send virtchnl add queues message 2631 - * @vport: Virtual port private data structure 2632 - * @num_tx_q: number of transmit queues 2633 - * @num_complq: number of transmit completion queues 2634 - * @num_rx_q: number of receive queues 2635 - * @num_rx_bufq: number of receive buffer queues 2560 + * @adapter: adapter pointer used to send virtchnl message 2561 + * @vport_config: vport persistent structure to store the queue chunk info 2562 + * @rsrc: pointer to queue and vector resources 2563 + * @vport_id: vport identifier used while preparing the virtchnl message 2636 2564 * 2637 - * Returns 0 on success, negative on failure. vport _MUST_ be const here as 2638 - * we should not change any fields within vport itself in this function. 2565 + * Return: 0 on success, negative on failure. 2639 2566 */ 2640 - int idpf_send_add_queues_msg(const struct idpf_vport *vport, u16 num_tx_q, 2641 - u16 num_complq, u16 num_rx_q, u16 num_rx_bufq) 2567 + int idpf_send_add_queues_msg(struct idpf_adapter *adapter, 2568 + struct idpf_vport_config *vport_config, 2569 + struct idpf_q_vec_rsrc *rsrc, 2570 + u32 vport_id) 2642 2571 { 2643 2572 struct virtchnl2_add_queues *vc_msg __free(kfree) = NULL; 2644 2573 struct idpf_vc_xn_params xn_params = {}; 2645 - struct idpf_vport_config *vport_config; 2646 2574 struct virtchnl2_add_queues aq = {}; 2647 - u16 vport_idx = vport->idx; 2648 2575 ssize_t reply_sz; 2649 2576 int size; 2650 2577 ··· 2644 2587 if (!vc_msg) 2645 2588 return -ENOMEM; 2646 2589 2647 - vport_config = vport->adapter->vport_config[vport_idx]; 2648 - kfree(vport_config->req_qs_chunks); 2649 - vport_config->req_qs_chunks = NULL; 2650 - 2651 - aq.vport_id = cpu_to_le32(vport->vport_id); 2652 - aq.num_tx_q = cpu_to_le16(num_tx_q); 2653 - aq.num_tx_complq = cpu_to_le16(num_complq); 2654 - aq.num_rx_q = cpu_to_le16(num_rx_q); 2655 - aq.num_rx_bufq = cpu_to_le16(num_rx_bufq); 2590 + aq.vport_id = cpu_to_le32(vport_id); 2591 + aq.num_tx_q = cpu_to_le16(rsrc->num_txq); 2592 + aq.num_tx_complq = cpu_to_le16(rsrc->num_complq); 2593 + aq.num_rx_q = cpu_to_le16(rsrc->num_rxq); 2594 + aq.num_rx_bufq = cpu_to_le16(rsrc->num_bufq); 2656 2595 2657 2596 xn_params.vc_op = VIRTCHNL2_OP_ADD_QUEUES; 2658 2597 xn_params.timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC; ··· 2656 2603 xn_params.send_buf.iov_len = sizeof(aq); 2657 2604 xn_params.recv_buf.iov_base = vc_msg; 2658 2605 xn_params.recv_buf.iov_len = IDPF_CTLQ_MAX_BUF_LEN; 2659 - reply_sz = idpf_vc_xn_exec(vport->adapter, &xn_params); 2606 + reply_sz = idpf_vc_xn_exec(adapter, &xn_params); 2660 2607 if (reply_sz < 0) 2661 2608 return reply_sz; 2662 2609 2663 2610 /* compare vc_msg num queues with vport num queues */ 2664 - if (le16_to_cpu(vc_msg->num_tx_q) != num_tx_q || 2665 - le16_to_cpu(vc_msg->num_rx_q) != num_rx_q || 2666 - le16_to_cpu(vc_msg->num_tx_complq) != num_complq || 2667 - le16_to_cpu(vc_msg->num_rx_bufq) != num_rx_bufq) 2611 + if (le16_to_cpu(vc_msg->num_tx_q) != rsrc->num_txq || 2612 + le16_to_cpu(vc_msg->num_rx_q) != rsrc->num_rxq || 2613 + le16_to_cpu(vc_msg->num_tx_complq) != rsrc->num_complq || 2614 + le16_to_cpu(vc_msg->num_rx_bufq) != rsrc->num_bufq) 2668 2615 return -EINVAL; 2669 2616 2670 2617 size = struct_size(vc_msg, chunks.chunks, ··· 2672 2619 if (reply_sz < size) 2673 2620 return -EIO; 2674 2621 2675 - vport_config->req_qs_chunks = kmemdup(vc_msg, size, GFP_KERNEL); 2676 - if (!vport_config->req_qs_chunks) 2677 - return -ENOMEM; 2678 - 2679 - return 0; 2622 + return idpf_vport_init_queue_reg_chunks(vport_config, &vc_msg->chunks); 2680 2623 } 2681 2624 2682 2625 /** ··· 2795 2746 2796 2747 /** 2797 2748 * idpf_send_get_stats_msg - Send virtchnl get statistics message 2798 - * @vport: vport to get stats for 2749 + * @np: netdev private structure 2750 + * @port_stats: structure to store the vport statistics 2799 2751 * 2800 - * Returns 0 on success, negative on failure. 2752 + * Return: 0 on success, negative on failure. 2801 2753 */ 2802 - int idpf_send_get_stats_msg(struct idpf_vport *vport) 2754 + int idpf_send_get_stats_msg(struct idpf_netdev_priv *np, 2755 + struct idpf_port_stats *port_stats) 2803 2756 { 2804 - struct idpf_netdev_priv *np = netdev_priv(vport->netdev); 2805 2757 struct rtnl_link_stats64 *netstats = &np->netstats; 2806 2758 struct virtchnl2_vport_stats stats_msg = {}; 2807 2759 struct idpf_vc_xn_params xn_params = {}; ··· 2813 2763 if (!test_bit(IDPF_VPORT_UP, np->state)) 2814 2764 return 0; 2815 2765 2816 - stats_msg.vport_id = cpu_to_le32(vport->vport_id); 2766 + stats_msg.vport_id = cpu_to_le32(np->vport_id); 2817 2767 2818 2768 xn_params.vc_op = VIRTCHNL2_OP_GET_STATS; 2819 2769 xn_params.send_buf.iov_base = &stats_msg; ··· 2821 2771 xn_params.recv_buf = xn_params.send_buf; 2822 2772 xn_params.timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC; 2823 2773 2824 - reply_sz = idpf_vc_xn_exec(vport->adapter, &xn_params); 2774 + reply_sz = idpf_vc_xn_exec(np->adapter, &xn_params); 2825 2775 if (reply_sz < 0) 2826 2776 return reply_sz; 2827 2777 if (reply_sz < sizeof(stats_msg)) ··· 2842 2792 netstats->rx_dropped = le64_to_cpu(stats_msg.rx_discards); 2843 2793 netstats->tx_dropped = le64_to_cpu(stats_msg.tx_discards); 2844 2794 2845 - vport->port_stats.vport_stats = stats_msg; 2795 + port_stats->vport_stats = stats_msg; 2846 2796 2847 2797 spin_unlock_bh(&np->stats_lock); 2848 2798 ··· 2850 2800 } 2851 2801 2852 2802 /** 2853 - * idpf_send_get_set_rss_lut_msg - Send virtchnl get or set rss lut message 2854 - * @vport: virtual port data structure 2855 - * @get: flag to set or get rss look up table 2803 + * idpf_send_get_set_rss_lut_msg - Send virtchnl get or set RSS lut message 2804 + * @adapter: adapter pointer used to send virtchnl message 2805 + * @rss_data: pointer to RSS key and lut info 2806 + * @vport_id: vport identifier used while preparing the virtchnl message 2807 + * @get: flag to set or get RSS look up table 2856 2808 * 2857 2809 * When rxhash is disabled, RSS LUT will be configured with zeros. If rxhash 2858 2810 * is enabled, the LUT values stored in driver's soft copy will be used to setup 2859 2811 * the HW. 2860 2812 * 2861 - * Returns 0 on success, negative on failure. 2813 + * Return: 0 on success, negative on failure. 2862 2814 */ 2863 - int idpf_send_get_set_rss_lut_msg(struct idpf_vport *vport, bool get) 2815 + int idpf_send_get_set_rss_lut_msg(struct idpf_adapter *adapter, 2816 + struct idpf_rss_data *rss_data, 2817 + u32 vport_id, bool get) 2864 2818 { 2865 2819 struct virtchnl2_rss_lut *recv_rl __free(kfree) = NULL; 2866 2820 struct virtchnl2_rss_lut *rl __free(kfree) = NULL; 2867 2821 struct idpf_vc_xn_params xn_params = {}; 2868 - struct idpf_rss_data *rss_data; 2869 2822 int buf_size, lut_buf_size; 2823 + struct idpf_vport *vport; 2870 2824 ssize_t reply_sz; 2871 2825 bool rxhash_ena; 2872 2826 int i; 2873 2827 2874 - rss_data = 2875 - &vport->adapter->vport_config[vport->idx]->user_config.rss_data; 2828 + vport = idpf_vid_to_vport(adapter, vport_id); 2829 + if (!vport) 2830 + return -EINVAL; 2831 + 2876 2832 rxhash_ena = idpf_is_feature_ena(vport, NETIF_F_RXHASH); 2833 + 2877 2834 buf_size = struct_size(rl, lut, rss_data->rss_lut_size); 2878 2835 rl = kzalloc(buf_size, GFP_KERNEL); 2879 2836 if (!rl) 2880 2837 return -ENOMEM; 2881 2838 2882 - rl->vport_id = cpu_to_le32(vport->vport_id); 2839 + rl->vport_id = cpu_to_le32(vport_id); 2883 2840 2884 2841 xn_params.timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC; 2885 2842 xn_params.send_buf.iov_base = rl; ··· 2907 2850 2908 2851 xn_params.vc_op = VIRTCHNL2_OP_SET_RSS_LUT; 2909 2852 } 2910 - reply_sz = idpf_vc_xn_exec(vport->adapter, &xn_params); 2853 + reply_sz = idpf_vc_xn_exec(adapter, &xn_params); 2911 2854 if (reply_sz < 0) 2912 2855 return reply_sz; 2913 2856 if (!get) ··· 2939 2882 } 2940 2883 2941 2884 /** 2942 - * idpf_send_get_set_rss_key_msg - Send virtchnl get or set rss key message 2943 - * @vport: virtual port data structure 2944 - * @get: flag to set or get rss look up table 2885 + * idpf_send_get_set_rss_key_msg - Send virtchnl get or set RSS key message 2886 + * @adapter: adapter pointer used to send virtchnl message 2887 + * @rss_data: pointer to RSS key and lut info 2888 + * @vport_id: vport identifier used while preparing the virtchnl message 2889 + * @get: flag to set or get RSS look up table 2945 2890 * 2946 - * Returns 0 on success, negative on failure 2891 + * Return: 0 on success, negative on failure 2947 2892 */ 2948 - int idpf_send_get_set_rss_key_msg(struct idpf_vport *vport, bool get) 2893 + int idpf_send_get_set_rss_key_msg(struct idpf_adapter *adapter, 2894 + struct idpf_rss_data *rss_data, 2895 + u32 vport_id, bool get) 2949 2896 { 2950 2897 struct virtchnl2_rss_key *recv_rk __free(kfree) = NULL; 2951 2898 struct virtchnl2_rss_key *rk __free(kfree) = NULL; 2952 2899 struct idpf_vc_xn_params xn_params = {}; 2953 - struct idpf_rss_data *rss_data; 2954 2900 ssize_t reply_sz; 2955 2901 int i, buf_size; 2956 2902 u16 key_size; 2957 2903 2958 - rss_data = 2959 - &vport->adapter->vport_config[vport->idx]->user_config.rss_data; 2960 2904 buf_size = struct_size(rk, key_flex, rss_data->rss_key_size); 2961 2905 rk = kzalloc(buf_size, GFP_KERNEL); 2962 2906 if (!rk) 2963 2907 return -ENOMEM; 2964 2908 2965 - rk->vport_id = cpu_to_le32(vport->vport_id); 2909 + rk->vport_id = cpu_to_le32(vport_id); 2966 2910 xn_params.send_buf.iov_base = rk; 2967 2911 xn_params.send_buf.iov_len = buf_size; 2968 2912 xn_params.timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC; ··· 2983 2925 xn_params.vc_op = VIRTCHNL2_OP_SET_RSS_KEY; 2984 2926 } 2985 2927 2986 - reply_sz = idpf_vc_xn_exec(vport->adapter, &xn_params); 2928 + reply_sz = idpf_vc_xn_exec(adapter, &xn_params); 2987 2929 if (reply_sz < 0) 2988 2930 return reply_sz; 2989 2931 if (!get) ··· 3069 3011 } 3070 3012 3071 3013 /** 3072 - * idpf_send_get_rx_ptype_msg - Send virtchnl for ptype info 3073 - * @vport: virtual port data structure 3074 - * 3075 - * Returns 0 on success, negative on failure. 3014 + * idpf_parse_protocol_ids - parse protocol IDs for a given packet type 3015 + * @ptype: packet type to parse 3016 + * @rx_pt: store the parsed packet type info into 3076 3017 */ 3077 - int idpf_send_get_rx_ptype_msg(struct idpf_vport *vport) 3018 + static void idpf_parse_protocol_ids(struct virtchnl2_ptype *ptype, 3019 + struct libeth_rx_pt *rx_pt) 3020 + { 3021 + struct idpf_ptype_state pstate = {}; 3022 + 3023 + for (u32 j = 0; j < ptype->proto_id_count; j++) { 3024 + u16 id = le16_to_cpu(ptype->proto_id[j]); 3025 + 3026 + switch (id) { 3027 + case VIRTCHNL2_PROTO_HDR_GRE: 3028 + if (pstate.tunnel_state == IDPF_PTYPE_TUNNEL_IP) { 3029 + rx_pt->tunnel_type = 3030 + LIBETH_RX_PT_TUNNEL_IP_GRENAT; 3031 + pstate.tunnel_state |= 3032 + IDPF_PTYPE_TUNNEL_IP_GRENAT; 3033 + } 3034 + break; 3035 + case VIRTCHNL2_PROTO_HDR_MAC: 3036 + rx_pt->outer_ip = LIBETH_RX_PT_OUTER_L2; 3037 + if (pstate.tunnel_state == IDPF_TUN_IP_GRE) { 3038 + rx_pt->tunnel_type = 3039 + LIBETH_RX_PT_TUNNEL_IP_GRENAT_MAC; 3040 + pstate.tunnel_state |= 3041 + IDPF_PTYPE_TUNNEL_IP_GRENAT_MAC; 3042 + } 3043 + break; 3044 + case VIRTCHNL2_PROTO_HDR_IPV4: 3045 + idpf_fill_ptype_lookup(rx_pt, &pstate, true, false); 3046 + break; 3047 + case VIRTCHNL2_PROTO_HDR_IPV6: 3048 + idpf_fill_ptype_lookup(rx_pt, &pstate, false, false); 3049 + break; 3050 + case VIRTCHNL2_PROTO_HDR_IPV4_FRAG: 3051 + idpf_fill_ptype_lookup(rx_pt, &pstate, true, true); 3052 + break; 3053 + case VIRTCHNL2_PROTO_HDR_IPV6_FRAG: 3054 + idpf_fill_ptype_lookup(rx_pt, &pstate, false, true); 3055 + break; 3056 + case VIRTCHNL2_PROTO_HDR_UDP: 3057 + rx_pt->inner_prot = LIBETH_RX_PT_INNER_UDP; 3058 + break; 3059 + case VIRTCHNL2_PROTO_HDR_TCP: 3060 + rx_pt->inner_prot = LIBETH_RX_PT_INNER_TCP; 3061 + break; 3062 + case VIRTCHNL2_PROTO_HDR_SCTP: 3063 + rx_pt->inner_prot = LIBETH_RX_PT_INNER_SCTP; 3064 + break; 3065 + case VIRTCHNL2_PROTO_HDR_ICMP: 3066 + rx_pt->inner_prot = LIBETH_RX_PT_INNER_ICMP; 3067 + break; 3068 + case VIRTCHNL2_PROTO_HDR_PAY: 3069 + rx_pt->payload_layer = LIBETH_RX_PT_PAYLOAD_L2; 3070 + break; 3071 + case VIRTCHNL2_PROTO_HDR_ICMPV6: 3072 + case VIRTCHNL2_PROTO_HDR_IPV6_EH: 3073 + case VIRTCHNL2_PROTO_HDR_PRE_MAC: 3074 + case VIRTCHNL2_PROTO_HDR_POST_MAC: 3075 + case VIRTCHNL2_PROTO_HDR_ETHERTYPE: 3076 + case VIRTCHNL2_PROTO_HDR_SVLAN: 3077 + case VIRTCHNL2_PROTO_HDR_CVLAN: 3078 + case VIRTCHNL2_PROTO_HDR_MPLS: 3079 + case VIRTCHNL2_PROTO_HDR_MMPLS: 3080 + case VIRTCHNL2_PROTO_HDR_PTP: 3081 + case VIRTCHNL2_PROTO_HDR_CTRL: 3082 + case VIRTCHNL2_PROTO_HDR_LLDP: 3083 + case VIRTCHNL2_PROTO_HDR_ARP: 3084 + case VIRTCHNL2_PROTO_HDR_ECP: 3085 + case VIRTCHNL2_PROTO_HDR_EAPOL: 3086 + case VIRTCHNL2_PROTO_HDR_PPPOD: 3087 + case VIRTCHNL2_PROTO_HDR_PPPOE: 3088 + case VIRTCHNL2_PROTO_HDR_IGMP: 3089 + case VIRTCHNL2_PROTO_HDR_AH: 3090 + case VIRTCHNL2_PROTO_HDR_ESP: 3091 + case VIRTCHNL2_PROTO_HDR_IKE: 3092 + case VIRTCHNL2_PROTO_HDR_NATT_KEEP: 3093 + case VIRTCHNL2_PROTO_HDR_L2TPV2: 3094 + case VIRTCHNL2_PROTO_HDR_L2TPV2_CONTROL: 3095 + case VIRTCHNL2_PROTO_HDR_L2TPV3: 3096 + case VIRTCHNL2_PROTO_HDR_GTP: 3097 + case VIRTCHNL2_PROTO_HDR_GTP_EH: 3098 + case VIRTCHNL2_PROTO_HDR_GTPCV2: 3099 + case VIRTCHNL2_PROTO_HDR_GTPC_TEID: 3100 + case VIRTCHNL2_PROTO_HDR_GTPU: 3101 + case VIRTCHNL2_PROTO_HDR_GTPU_UL: 3102 + case VIRTCHNL2_PROTO_HDR_GTPU_DL: 3103 + case VIRTCHNL2_PROTO_HDR_ECPRI: 3104 + case VIRTCHNL2_PROTO_HDR_VRRP: 3105 + case VIRTCHNL2_PROTO_HDR_OSPF: 3106 + case VIRTCHNL2_PROTO_HDR_TUN: 3107 + case VIRTCHNL2_PROTO_HDR_NVGRE: 3108 + case VIRTCHNL2_PROTO_HDR_VXLAN: 3109 + case VIRTCHNL2_PROTO_HDR_VXLAN_GPE: 3110 + case VIRTCHNL2_PROTO_HDR_GENEVE: 3111 + case VIRTCHNL2_PROTO_HDR_NSH: 3112 + case VIRTCHNL2_PROTO_HDR_QUIC: 3113 + case VIRTCHNL2_PROTO_HDR_PFCP: 3114 + case VIRTCHNL2_PROTO_HDR_PFCP_NODE: 3115 + case VIRTCHNL2_PROTO_HDR_PFCP_SESSION: 3116 + case VIRTCHNL2_PROTO_HDR_RTP: 3117 + case VIRTCHNL2_PROTO_HDR_NO_PROTO: 3118 + break; 3119 + default: 3120 + break; 3121 + } 3122 + } 3123 + } 3124 + 3125 + /** 3126 + * idpf_send_get_rx_ptype_msg - Send virtchnl for ptype info 3127 + * @adapter: driver specific private structure 3128 + * 3129 + * Return: 0 on success, negative on failure. 3130 + */ 3131 + static int idpf_send_get_rx_ptype_msg(struct idpf_adapter *adapter) 3078 3132 { 3079 3133 struct virtchnl2_get_ptype_info *get_ptype_info __free(kfree) = NULL; 3080 3134 struct virtchnl2_get_ptype_info *ptype_info __free(kfree) = NULL; 3081 - struct libeth_rx_pt *ptype_lkup __free(kfree) = NULL; 3082 - int max_ptype, ptypes_recvd = 0, ptype_offset; 3083 - struct idpf_adapter *adapter = vport->adapter; 3135 + struct libeth_rx_pt *singleq_pt_lkup __free(kfree) = NULL; 3136 + struct libeth_rx_pt *splitq_pt_lkup __free(kfree) = NULL; 3084 3137 struct idpf_vc_xn_params xn_params = {}; 3138 + int ptypes_recvd = 0, ptype_offset; 3139 + u32 max_ptype = IDPF_RX_MAX_PTYPE; 3085 3140 u16 next_ptype_id = 0; 3086 3141 ssize_t reply_sz; 3087 - int i, j, k; 3088 3142 3089 - if (vport->rx_ptype_lkup) 3090 - return 0; 3143 + singleq_pt_lkup = kcalloc(IDPF_RX_MAX_BASE_PTYPE, 3144 + sizeof(*singleq_pt_lkup), GFP_KERNEL); 3145 + if (!singleq_pt_lkup) 3146 + return -ENOMEM; 3091 3147 3092 - if (idpf_is_queue_model_split(vport->rxq_model)) 3093 - max_ptype = IDPF_RX_MAX_PTYPE; 3094 - else 3095 - max_ptype = IDPF_RX_MAX_BASE_PTYPE; 3096 - 3097 - ptype_lkup = kcalloc(max_ptype, sizeof(*ptype_lkup), GFP_KERNEL); 3098 - if (!ptype_lkup) 3148 + splitq_pt_lkup = kcalloc(max_ptype, sizeof(*splitq_pt_lkup), GFP_KERNEL); 3149 + if (!splitq_pt_lkup) 3099 3150 return -ENOMEM; 3100 3151 3101 3152 get_ptype_info = kzalloc(sizeof(*get_ptype_info), GFP_KERNEL); ··· 3245 3078 3246 3079 ptype_offset = IDPF_RX_PTYPE_HDR_SZ; 3247 3080 3248 - for (i = 0; i < le16_to_cpu(ptype_info->num_ptypes); i++) { 3249 - struct idpf_ptype_state pstate = { }; 3081 + for (u16 i = 0; i < le16_to_cpu(ptype_info->num_ptypes); i++) { 3082 + struct libeth_rx_pt rx_pt = {}; 3250 3083 struct virtchnl2_ptype *ptype; 3251 - u16 id; 3084 + u16 pt_10, pt_8; 3252 3085 3253 3086 ptype = (struct virtchnl2_ptype *) 3254 3087 ((u8 *)ptype_info + ptype_offset); 3088 + 3089 + pt_10 = le16_to_cpu(ptype->ptype_id_10); 3090 + pt_8 = ptype->ptype_id_8; 3255 3091 3256 3092 ptype_offset += IDPF_GET_PTYPE_SIZE(ptype); 3257 3093 if (ptype_offset > IDPF_CTLQ_MAX_BUF_LEN) 3258 3094 return -EINVAL; 3259 3095 3260 3096 /* 0xFFFF indicates end of ptypes */ 3261 - if (le16_to_cpu(ptype->ptype_id_10) == 3262 - IDPF_INVALID_PTYPE_ID) 3097 + if (pt_10 == IDPF_INVALID_PTYPE_ID) 3263 3098 goto out; 3099 + if (pt_10 >= max_ptype) 3100 + return -EINVAL; 3264 3101 3265 - if (idpf_is_queue_model_split(vport->rxq_model)) 3266 - k = le16_to_cpu(ptype->ptype_id_10); 3267 - else 3268 - k = ptype->ptype_id_8; 3102 + idpf_parse_protocol_ids(ptype, &rx_pt); 3103 + idpf_finalize_ptype_lookup(&rx_pt); 3269 3104 3270 - for (j = 0; j < ptype->proto_id_count; j++) { 3271 - id = le16_to_cpu(ptype->proto_id[j]); 3272 - switch (id) { 3273 - case VIRTCHNL2_PROTO_HDR_GRE: 3274 - if (pstate.tunnel_state == 3275 - IDPF_PTYPE_TUNNEL_IP) { 3276 - ptype_lkup[k].tunnel_type = 3277 - LIBETH_RX_PT_TUNNEL_IP_GRENAT; 3278 - pstate.tunnel_state |= 3279 - IDPF_PTYPE_TUNNEL_IP_GRENAT; 3280 - } 3281 - break; 3282 - case VIRTCHNL2_PROTO_HDR_MAC: 3283 - ptype_lkup[k].outer_ip = 3284 - LIBETH_RX_PT_OUTER_L2; 3285 - if (pstate.tunnel_state == 3286 - IDPF_TUN_IP_GRE) { 3287 - ptype_lkup[k].tunnel_type = 3288 - LIBETH_RX_PT_TUNNEL_IP_GRENAT_MAC; 3289 - pstate.tunnel_state |= 3290 - IDPF_PTYPE_TUNNEL_IP_GRENAT_MAC; 3291 - } 3292 - break; 3293 - case VIRTCHNL2_PROTO_HDR_IPV4: 3294 - idpf_fill_ptype_lookup(&ptype_lkup[k], 3295 - &pstate, true, 3296 - false); 3297 - break; 3298 - case VIRTCHNL2_PROTO_HDR_IPV6: 3299 - idpf_fill_ptype_lookup(&ptype_lkup[k], 3300 - &pstate, false, 3301 - false); 3302 - break; 3303 - case VIRTCHNL2_PROTO_HDR_IPV4_FRAG: 3304 - idpf_fill_ptype_lookup(&ptype_lkup[k], 3305 - &pstate, true, 3306 - true); 3307 - break; 3308 - case VIRTCHNL2_PROTO_HDR_IPV6_FRAG: 3309 - idpf_fill_ptype_lookup(&ptype_lkup[k], 3310 - &pstate, false, 3311 - true); 3312 - break; 3313 - case VIRTCHNL2_PROTO_HDR_UDP: 3314 - ptype_lkup[k].inner_prot = 3315 - LIBETH_RX_PT_INNER_UDP; 3316 - break; 3317 - case VIRTCHNL2_PROTO_HDR_TCP: 3318 - ptype_lkup[k].inner_prot = 3319 - LIBETH_RX_PT_INNER_TCP; 3320 - break; 3321 - case VIRTCHNL2_PROTO_HDR_SCTP: 3322 - ptype_lkup[k].inner_prot = 3323 - LIBETH_RX_PT_INNER_SCTP; 3324 - break; 3325 - case VIRTCHNL2_PROTO_HDR_ICMP: 3326 - ptype_lkup[k].inner_prot = 3327 - LIBETH_RX_PT_INNER_ICMP; 3328 - break; 3329 - case VIRTCHNL2_PROTO_HDR_PAY: 3330 - ptype_lkup[k].payload_layer = 3331 - LIBETH_RX_PT_PAYLOAD_L2; 3332 - break; 3333 - case VIRTCHNL2_PROTO_HDR_ICMPV6: 3334 - case VIRTCHNL2_PROTO_HDR_IPV6_EH: 3335 - case VIRTCHNL2_PROTO_HDR_PRE_MAC: 3336 - case VIRTCHNL2_PROTO_HDR_POST_MAC: 3337 - case VIRTCHNL2_PROTO_HDR_ETHERTYPE: 3338 - case VIRTCHNL2_PROTO_HDR_SVLAN: 3339 - case VIRTCHNL2_PROTO_HDR_CVLAN: 3340 - case VIRTCHNL2_PROTO_HDR_MPLS: 3341 - case VIRTCHNL2_PROTO_HDR_MMPLS: 3342 - case VIRTCHNL2_PROTO_HDR_PTP: 3343 - case VIRTCHNL2_PROTO_HDR_CTRL: 3344 - case VIRTCHNL2_PROTO_HDR_LLDP: 3345 - case VIRTCHNL2_PROTO_HDR_ARP: 3346 - case VIRTCHNL2_PROTO_HDR_ECP: 3347 - case VIRTCHNL2_PROTO_HDR_EAPOL: 3348 - case VIRTCHNL2_PROTO_HDR_PPPOD: 3349 - case VIRTCHNL2_PROTO_HDR_PPPOE: 3350 - case VIRTCHNL2_PROTO_HDR_IGMP: 3351 - case VIRTCHNL2_PROTO_HDR_AH: 3352 - case VIRTCHNL2_PROTO_HDR_ESP: 3353 - case VIRTCHNL2_PROTO_HDR_IKE: 3354 - case VIRTCHNL2_PROTO_HDR_NATT_KEEP: 3355 - case VIRTCHNL2_PROTO_HDR_L2TPV2: 3356 - case VIRTCHNL2_PROTO_HDR_L2TPV2_CONTROL: 3357 - case VIRTCHNL2_PROTO_HDR_L2TPV3: 3358 - case VIRTCHNL2_PROTO_HDR_GTP: 3359 - case VIRTCHNL2_PROTO_HDR_GTP_EH: 3360 - case VIRTCHNL2_PROTO_HDR_GTPCV2: 3361 - case VIRTCHNL2_PROTO_HDR_GTPC_TEID: 3362 - case VIRTCHNL2_PROTO_HDR_GTPU: 3363 - case VIRTCHNL2_PROTO_HDR_GTPU_UL: 3364 - case VIRTCHNL2_PROTO_HDR_GTPU_DL: 3365 - case VIRTCHNL2_PROTO_HDR_ECPRI: 3366 - case VIRTCHNL2_PROTO_HDR_VRRP: 3367 - case VIRTCHNL2_PROTO_HDR_OSPF: 3368 - case VIRTCHNL2_PROTO_HDR_TUN: 3369 - case VIRTCHNL2_PROTO_HDR_NVGRE: 3370 - case VIRTCHNL2_PROTO_HDR_VXLAN: 3371 - case VIRTCHNL2_PROTO_HDR_VXLAN_GPE: 3372 - case VIRTCHNL2_PROTO_HDR_GENEVE: 3373 - case VIRTCHNL2_PROTO_HDR_NSH: 3374 - case VIRTCHNL2_PROTO_HDR_QUIC: 3375 - case VIRTCHNL2_PROTO_HDR_PFCP: 3376 - case VIRTCHNL2_PROTO_HDR_PFCP_NODE: 3377 - case VIRTCHNL2_PROTO_HDR_PFCP_SESSION: 3378 - case VIRTCHNL2_PROTO_HDR_RTP: 3379 - case VIRTCHNL2_PROTO_HDR_NO_PROTO: 3380 - break; 3381 - default: 3382 - break; 3383 - } 3384 - } 3385 - 3386 - idpf_finalize_ptype_lookup(&ptype_lkup[k]); 3105 + /* For a given protocol ID stack, the ptype value might 3106 + * vary between ptype_id_10 and ptype_id_8. So store 3107 + * them separately for splitq and singleq. Also skip 3108 + * the repeated ptypes in case of singleq. 3109 + */ 3110 + splitq_pt_lkup[pt_10] = rx_pt; 3111 + if (!singleq_pt_lkup[pt_8].outer_ip) 3112 + singleq_pt_lkup[pt_8] = rx_pt; 3387 3113 } 3388 3114 } 3389 3115 3390 3116 out: 3391 - vport->rx_ptype_lkup = no_free_ptr(ptype_lkup); 3117 + adapter->splitq_pt_lkup = no_free_ptr(splitq_pt_lkup); 3118 + adapter->singleq_pt_lkup = no_free_ptr(singleq_pt_lkup); 3392 3119 3393 3120 return 0; 3394 3121 } 3395 3122 3396 3123 /** 3124 + * idpf_rel_rx_pt_lkup - release RX ptype lookup table 3125 + * @adapter: adapter pointer to get the lookup table 3126 + */ 3127 + static void idpf_rel_rx_pt_lkup(struct idpf_adapter *adapter) 3128 + { 3129 + kfree(adapter->splitq_pt_lkup); 3130 + adapter->splitq_pt_lkup = NULL; 3131 + 3132 + kfree(adapter->singleq_pt_lkup); 3133 + adapter->singleq_pt_lkup = NULL; 3134 + } 3135 + 3136 + /** 3397 3137 * idpf_send_ena_dis_loopback_msg - Send virtchnl enable/disable loopback 3398 3138 * message 3399 - * @vport: virtual port data structure 3139 + * @adapter: adapter pointer used to send virtchnl message 3140 + * @vport_id: vport identifier used while preparing the virtchnl message 3141 + * @loopback_ena: flag to enable or disable loopback 3400 3142 * 3401 - * Returns 0 on success, negative on failure. 3143 + * Return: 0 on success, negative on failure. 3402 3144 */ 3403 - int idpf_send_ena_dis_loopback_msg(struct idpf_vport *vport) 3145 + int idpf_send_ena_dis_loopback_msg(struct idpf_adapter *adapter, u32 vport_id, 3146 + bool loopback_ena) 3404 3147 { 3405 3148 struct idpf_vc_xn_params xn_params = {}; 3406 3149 struct virtchnl2_loopback loopback; 3407 3150 ssize_t reply_sz; 3408 3151 3409 - loopback.vport_id = cpu_to_le32(vport->vport_id); 3410 - loopback.enable = idpf_is_feature_ena(vport, NETIF_F_LOOPBACK); 3152 + loopback.vport_id = cpu_to_le32(vport_id); 3153 + loopback.enable = loopback_ena; 3411 3154 3412 3155 xn_params.vc_op = VIRTCHNL2_OP_LOOPBACK; 3413 3156 xn_params.timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC; 3414 3157 xn_params.send_buf.iov_base = &loopback; 3415 3158 xn_params.send_buf.iov_len = sizeof(loopback); 3416 - reply_sz = idpf_vc_xn_exec(vport->adapter, &xn_params); 3159 + reply_sz = idpf_vc_xn_exec(adapter, &xn_params); 3417 3160 3418 3161 return reply_sz < 0 ? reply_sz : 0; 3419 3162 } ··· 3402 3325 void idpf_deinit_dflt_mbx(struct idpf_adapter *adapter) 3403 3326 { 3404 3327 if (adapter->hw.arq && adapter->hw.asq) { 3405 - idpf_mb_clean(adapter); 3328 + idpf_mb_clean(adapter, adapter->hw.asq); 3406 3329 idpf_ctlq_deinit(&adapter->hw); 3407 3330 } 3408 3331 adapter->hw.arq = NULL; ··· 3597 3520 goto err_intr_req; 3598 3521 } 3599 3522 3523 + err = idpf_send_get_rx_ptype_msg(adapter); 3524 + if (err) { 3525 + dev_err(&adapter->pdev->dev, "failed to get RX ptypes: %d\n", 3526 + err); 3527 + goto intr_rel; 3528 + } 3529 + 3600 3530 err = idpf_ptp_init(adapter); 3601 3531 if (err) 3602 3532 pci_err(adapter->pdev, "PTP init failed, err=%pe\n", ··· 3621 3537 3622 3538 return 0; 3623 3539 3540 + intr_rel: 3541 + idpf_intr_rel(adapter); 3624 3542 err_intr_req: 3625 3543 cancel_delayed_work_sync(&adapter->serv_task); 3626 3544 cancel_delayed_work_sync(&adapter->mbx_task); ··· 3677 3591 idpf_ptp_release(adapter); 3678 3592 idpf_deinit_task(adapter); 3679 3593 idpf_idc_deinit_core_aux_device(adapter->cdev_info); 3594 + idpf_rel_rx_pt_lkup(adapter); 3680 3595 idpf_intr_rel(adapter); 3681 3596 3682 3597 if (remove_in_prog) ··· 3700 3613 /** 3701 3614 * idpf_vport_alloc_vec_indexes - Get relative vector indexes 3702 3615 * @vport: virtual port data struct 3616 + * @rsrc: pointer to queue and vector resources 3703 3617 * 3704 3618 * This function requests the vector information required for the vport and 3705 3619 * stores the vector indexes received from the 'global vector distribution' 3706 3620 * in the vport's queue vectors array. 3707 3621 * 3708 - * Return 0 on success, error on failure 3622 + * Return: 0 on success, error on failure 3709 3623 */ 3710 - int idpf_vport_alloc_vec_indexes(struct idpf_vport *vport) 3624 + int idpf_vport_alloc_vec_indexes(struct idpf_vport *vport, 3625 + struct idpf_q_vec_rsrc *rsrc) 3711 3626 { 3712 3627 struct idpf_vector_info vec_info; 3713 3628 int num_alloc_vecs; 3714 3629 u32 req; 3715 3630 3716 - vec_info.num_curr_vecs = vport->num_q_vectors; 3631 + vec_info.num_curr_vecs = rsrc->num_q_vectors; 3717 3632 if (vec_info.num_curr_vecs) 3718 3633 vec_info.num_curr_vecs += IDPF_RESERVED_VECS; 3719 3634 3720 3635 /* XDPSQs are all bound to the NOIRQ vector from IDPF_RESERVED_VECS */ 3721 - req = max(vport->num_txq - vport->num_xdp_txq, vport->num_rxq) + 3636 + req = max(rsrc->num_txq - vport->num_xdp_txq, rsrc->num_rxq) + 3722 3637 IDPF_RESERVED_VECS; 3723 3638 vec_info.num_req_vecs = req; 3724 3639 ··· 3728 3639 vec_info.index = vport->idx; 3729 3640 3730 3641 num_alloc_vecs = idpf_req_rel_vector_indexes(vport->adapter, 3731 - vport->q_vector_idxs, 3642 + rsrc->q_vector_idxs, 3732 3643 &vec_info); 3733 3644 if (num_alloc_vecs <= 0) { 3734 3645 dev_err(&vport->adapter->pdev->dev, "Vector distribution failed: %d\n", ··· 3736 3647 return -EINVAL; 3737 3648 } 3738 3649 3739 - vport->num_q_vectors = num_alloc_vecs - IDPF_RESERVED_VECS; 3650 + rsrc->num_q_vectors = num_alloc_vecs - IDPF_RESERVED_VECS; 3740 3651 3741 3652 return 0; 3742 3653 } ··· 3747 3658 * @max_q: vport max queue info 3748 3659 * 3749 3660 * Will initialize vport with the info received through MB earlier 3661 + * 3662 + * Return: 0 on success, negative on failure. 3750 3663 */ 3751 - void idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q) 3664 + int idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q) 3752 3665 { 3666 + struct idpf_q_vec_rsrc *rsrc = &vport->dflt_qv_rsrc; 3753 3667 struct idpf_adapter *adapter = vport->adapter; 3754 3668 struct virtchnl2_create_vport *vport_msg; 3755 3669 struct idpf_vport_config *vport_config; ··· 3766 3674 rss_data = &vport_config->user_config.rss_data; 3767 3675 vport_msg = adapter->vport_params_recvd[idx]; 3768 3676 3677 + err = idpf_vport_init_queue_reg_chunks(vport_config, 3678 + &vport_msg->chunks); 3679 + if (err) 3680 + return err; 3681 + 3769 3682 vport_config->max_q.max_txq = max_q->max_txq; 3770 3683 vport_config->max_q.max_rxq = max_q->max_rxq; 3771 3684 vport_config->max_q.max_complq = max_q->max_complq; 3772 3685 vport_config->max_q.max_bufq = max_q->max_bufq; 3773 3686 3774 - vport->txq_model = le16_to_cpu(vport_msg->txq_model); 3775 - vport->rxq_model = le16_to_cpu(vport_msg->rxq_model); 3687 + rsrc->txq_model = le16_to_cpu(vport_msg->txq_model); 3688 + rsrc->rxq_model = le16_to_cpu(vport_msg->rxq_model); 3776 3689 vport->vport_type = le16_to_cpu(vport_msg->vport_type); 3777 3690 vport->vport_id = le32_to_cpu(vport_msg->vport_id); 3778 3691 ··· 3794 3697 3795 3698 idpf_vport_set_hsplit(vport, ETHTOOL_TCP_DATA_SPLIT_ENABLED); 3796 3699 3797 - idpf_vport_init_num_qs(vport, vport_msg); 3798 - idpf_vport_calc_num_q_desc(vport); 3799 - idpf_vport_calc_num_q_groups(vport); 3800 - idpf_vport_alloc_vec_indexes(vport); 3700 + idpf_vport_init_num_qs(vport, vport_msg, rsrc); 3701 + idpf_vport_calc_num_q_desc(vport, rsrc); 3702 + idpf_vport_calc_num_q_groups(rsrc); 3703 + idpf_vport_alloc_vec_indexes(vport, rsrc); 3801 3704 3802 3705 vport->crc_enable = adapter->crc_enable; 3803 3706 3804 3707 if (!(vport_msg->vport_flags & 3805 3708 cpu_to_le16(VIRTCHNL2_VPORT_UPLINK_PORT))) 3806 - return; 3709 + return 0; 3807 3710 3808 3711 err = idpf_ptp_get_vport_tstamps_caps(vport); 3809 3712 if (err) { 3713 + /* Do not error on timestamp failure */ 3810 3714 pci_dbg(vport->adapter->pdev, "Tx timestamping not supported\n"); 3811 - return; 3715 + return 0; 3812 3716 } 3813 3717 3814 3718 INIT_WORK(&vport->tstamp_task, idpf_tstamp_task); 3719 + 3720 + return 0; 3815 3721 } 3816 3722 3817 3723 /** ··· 3873 3773 * Returns number of ids filled 3874 3774 */ 3875 3775 static int idpf_vport_get_queue_ids(u32 *qids, int num_qids, u16 q_type, 3876 - struct virtchnl2_queue_reg_chunks *chunks) 3776 + struct idpf_queue_id_reg_info *chunks) 3877 3777 { 3878 - u16 num_chunks = le16_to_cpu(chunks->num_chunks); 3778 + u16 num_chunks = chunks->num_chunks; 3879 3779 u32 num_q_id_filled = 0, i; 3880 3780 u32 start_q_id, num_q; 3881 3781 3882 3782 while (num_chunks--) { 3883 - struct virtchnl2_queue_reg_chunk *chunk; 3783 + struct idpf_queue_id_reg_chunk *chunk; 3884 3784 3885 - chunk = &chunks->chunks[num_chunks]; 3886 - if (le32_to_cpu(chunk->type) != q_type) 3785 + chunk = &chunks->queue_chunks[num_chunks]; 3786 + if (chunk->type != q_type) 3887 3787 continue; 3888 3788 3889 - num_q = le32_to_cpu(chunk->num_queues); 3890 - start_q_id = le32_to_cpu(chunk->start_queue_id); 3789 + num_q = chunk->num_queues; 3790 + start_q_id = chunk->start_queue_id; 3891 3791 3892 3792 for (i = 0; i < num_q; i++) { 3893 3793 if ((num_q_id_filled + i) < num_qids) { ··· 3906 3806 /** 3907 3807 * __idpf_vport_queue_ids_init - Initialize queue ids from Mailbox parameters 3908 3808 * @vport: virtual port for which the queues ids are initialized 3809 + * @rsrc: pointer to queue and vector resources 3909 3810 * @qids: queue ids 3910 3811 * @num_qids: number of queue ids 3911 3812 * @q_type: type of queue ··· 3915 3814 * parameters. Returns number of queue ids initialized. 3916 3815 */ 3917 3816 static int __idpf_vport_queue_ids_init(struct idpf_vport *vport, 3817 + struct idpf_q_vec_rsrc *rsrc, 3918 3818 const u32 *qids, 3919 3819 int num_qids, 3920 3820 u32 q_type) ··· 3924 3822 3925 3823 switch (q_type) { 3926 3824 case VIRTCHNL2_QUEUE_TYPE_TX: 3927 - for (i = 0; i < vport->num_txq_grp; i++) { 3928 - struct idpf_txq_group *tx_qgrp = &vport->txq_grps[i]; 3825 + for (i = 0; i < rsrc->num_txq_grp; i++) { 3826 + struct idpf_txq_group *tx_qgrp = &rsrc->txq_grps[i]; 3929 3827 3930 3828 for (j = 0; j < tx_qgrp->num_txq && k < num_qids; j++, k++) 3931 3829 tx_qgrp->txqs[j]->q_id = qids[k]; 3932 3830 } 3933 3831 break; 3934 3832 case VIRTCHNL2_QUEUE_TYPE_RX: 3935 - for (i = 0; i < vport->num_rxq_grp; i++) { 3936 - struct idpf_rxq_group *rx_qgrp = &vport->rxq_grps[i]; 3833 + for (i = 0; i < rsrc->num_rxq_grp; i++) { 3834 + struct idpf_rxq_group *rx_qgrp = &rsrc->rxq_grps[i]; 3937 3835 u16 num_rxq; 3938 3836 3939 - if (idpf_is_queue_model_split(vport->rxq_model)) 3837 + if (idpf_is_queue_model_split(rsrc->rxq_model)) 3940 3838 num_rxq = rx_qgrp->splitq.num_rxq_sets; 3941 3839 else 3942 3840 num_rxq = rx_qgrp->singleq.num_rxq; ··· 3944 3842 for (j = 0; j < num_rxq && k < num_qids; j++, k++) { 3945 3843 struct idpf_rx_queue *q; 3946 3844 3947 - if (idpf_is_queue_model_split(vport->rxq_model)) 3845 + if (idpf_is_queue_model_split(rsrc->rxq_model)) 3948 3846 q = &rx_qgrp->splitq.rxq_sets[j]->rxq; 3949 3847 else 3950 3848 q = rx_qgrp->singleq.rxqs[j]; ··· 3953 3851 } 3954 3852 break; 3955 3853 case VIRTCHNL2_QUEUE_TYPE_TX_COMPLETION: 3956 - for (i = 0; i < vport->num_txq_grp && k < num_qids; i++, k++) { 3957 - struct idpf_txq_group *tx_qgrp = &vport->txq_grps[i]; 3854 + for (i = 0; i < rsrc->num_txq_grp && k < num_qids; i++, k++) { 3855 + struct idpf_txq_group *tx_qgrp = &rsrc->txq_grps[i]; 3958 3856 3959 3857 tx_qgrp->complq->q_id = qids[k]; 3960 3858 } 3961 3859 break; 3962 3860 case VIRTCHNL2_QUEUE_TYPE_RX_BUFFER: 3963 - for (i = 0; i < vport->num_rxq_grp; i++) { 3964 - struct idpf_rxq_group *rx_qgrp = &vport->rxq_grps[i]; 3965 - u8 num_bufqs = vport->num_bufqs_per_qgrp; 3861 + for (i = 0; i < rsrc->num_rxq_grp; i++) { 3862 + struct idpf_rxq_group *rx_qgrp = &rsrc->rxq_grps[i]; 3863 + u8 num_bufqs = rsrc->num_bufqs_per_qgrp; 3966 3864 3967 3865 for (j = 0; j < num_bufqs && k < num_qids; j++, k++) { 3968 3866 struct idpf_buf_queue *q; ··· 3982 3880 /** 3983 3881 * idpf_vport_queue_ids_init - Initialize queue ids from Mailbox parameters 3984 3882 * @vport: virtual port for which the queues ids are initialized 3883 + * @rsrc: pointer to queue and vector resources 3884 + * @chunks: queue ids received over mailbox 3985 3885 * 3986 3886 * Will initialize all queue ids with ids received as mailbox parameters. 3987 - * Returns 0 on success, negative if all the queues are not initialized. 3887 + * 3888 + * Return: 0 on success, negative if all the queues are not initialized. 3988 3889 */ 3989 - int idpf_vport_queue_ids_init(struct idpf_vport *vport) 3890 + int idpf_vport_queue_ids_init(struct idpf_vport *vport, 3891 + struct idpf_q_vec_rsrc *rsrc, 3892 + struct idpf_queue_id_reg_info *chunks) 3990 3893 { 3991 - struct virtchnl2_create_vport *vport_params; 3992 - struct virtchnl2_queue_reg_chunks *chunks; 3993 - struct idpf_vport_config *vport_config; 3994 - u16 vport_idx = vport->idx; 3995 3894 int num_ids, err = 0; 3996 3895 u16 q_type; 3997 3896 u32 *qids; 3998 - 3999 - vport_config = vport->adapter->vport_config[vport_idx]; 4000 - if (vport_config->req_qs_chunks) { 4001 - struct virtchnl2_add_queues *vc_aq = 4002 - (struct virtchnl2_add_queues *)vport_config->req_qs_chunks; 4003 - chunks = &vc_aq->chunks; 4004 - } else { 4005 - vport_params = vport->adapter->vport_params_recvd[vport_idx]; 4006 - chunks = &vport_params->chunks; 4007 - } 4008 3897 4009 3898 qids = kcalloc(IDPF_MAX_QIDS, sizeof(u32), GFP_KERNEL); 4010 3899 if (!qids) ··· 4004 3911 num_ids = idpf_vport_get_queue_ids(qids, IDPF_MAX_QIDS, 4005 3912 VIRTCHNL2_QUEUE_TYPE_TX, 4006 3913 chunks); 4007 - if (num_ids < vport->num_txq) { 3914 + if (num_ids < rsrc->num_txq) { 4008 3915 err = -EINVAL; 4009 3916 goto mem_rel; 4010 3917 } 4011 - num_ids = __idpf_vport_queue_ids_init(vport, qids, num_ids, 3918 + num_ids = __idpf_vport_queue_ids_init(vport, rsrc, qids, num_ids, 4012 3919 VIRTCHNL2_QUEUE_TYPE_TX); 4013 - if (num_ids < vport->num_txq) { 3920 + if (num_ids < rsrc->num_txq) { 4014 3921 err = -EINVAL; 4015 3922 goto mem_rel; 4016 3923 } ··· 4018 3925 num_ids = idpf_vport_get_queue_ids(qids, IDPF_MAX_QIDS, 4019 3926 VIRTCHNL2_QUEUE_TYPE_RX, 4020 3927 chunks); 4021 - if (num_ids < vport->num_rxq) { 3928 + if (num_ids < rsrc->num_rxq) { 4022 3929 err = -EINVAL; 4023 3930 goto mem_rel; 4024 3931 } 4025 - num_ids = __idpf_vport_queue_ids_init(vport, qids, num_ids, 3932 + num_ids = __idpf_vport_queue_ids_init(vport, rsrc, qids, num_ids, 4026 3933 VIRTCHNL2_QUEUE_TYPE_RX); 4027 - if (num_ids < vport->num_rxq) { 3934 + if (num_ids < rsrc->num_rxq) { 4028 3935 err = -EINVAL; 4029 3936 goto mem_rel; 4030 3937 } 4031 3938 4032 - if (!idpf_is_queue_model_split(vport->txq_model)) 3939 + if (!idpf_is_queue_model_split(rsrc->txq_model)) 4033 3940 goto check_rxq; 4034 3941 4035 3942 q_type = VIRTCHNL2_QUEUE_TYPE_TX_COMPLETION; 4036 3943 num_ids = idpf_vport_get_queue_ids(qids, IDPF_MAX_QIDS, q_type, chunks); 4037 - if (num_ids < vport->num_complq) { 3944 + if (num_ids < rsrc->num_complq) { 4038 3945 err = -EINVAL; 4039 3946 goto mem_rel; 4040 3947 } 4041 - num_ids = __idpf_vport_queue_ids_init(vport, qids, num_ids, q_type); 4042 - if (num_ids < vport->num_complq) { 3948 + num_ids = __idpf_vport_queue_ids_init(vport, rsrc, qids, 3949 + num_ids, q_type); 3950 + if (num_ids < rsrc->num_complq) { 4043 3951 err = -EINVAL; 4044 3952 goto mem_rel; 4045 3953 } 4046 3954 4047 3955 check_rxq: 4048 - if (!idpf_is_queue_model_split(vport->rxq_model)) 3956 + if (!idpf_is_queue_model_split(rsrc->rxq_model)) 4049 3957 goto mem_rel; 4050 3958 4051 3959 q_type = VIRTCHNL2_QUEUE_TYPE_RX_BUFFER; 4052 3960 num_ids = idpf_vport_get_queue_ids(qids, IDPF_MAX_QIDS, q_type, chunks); 4053 - if (num_ids < vport->num_bufq) { 3961 + if (num_ids < rsrc->num_bufq) { 4054 3962 err = -EINVAL; 4055 3963 goto mem_rel; 4056 3964 } 4057 - num_ids = __idpf_vport_queue_ids_init(vport, qids, num_ids, q_type); 4058 - if (num_ids < vport->num_bufq) 3965 + num_ids = __idpf_vport_queue_ids_init(vport, rsrc, qids, 3966 + num_ids, q_type); 3967 + if (num_ids < rsrc->num_bufq) 4059 3968 err = -EINVAL; 4060 3969 4061 3970 mem_rel: ··· 4069 3974 /** 4070 3975 * idpf_vport_adjust_qs - Adjust to new requested queues 4071 3976 * @vport: virtual port data struct 3977 + * @rsrc: pointer to queue and vector resources 4072 3978 * 4073 3979 * Renegotiate queues. Returns 0 on success, negative on failure. 4074 3980 */ 4075 - int idpf_vport_adjust_qs(struct idpf_vport *vport) 3981 + int idpf_vport_adjust_qs(struct idpf_vport *vport, struct idpf_q_vec_rsrc *rsrc) 4076 3982 { 4077 3983 struct virtchnl2_create_vport vport_msg; 4078 3984 int err; 4079 3985 4080 - vport_msg.txq_model = cpu_to_le16(vport->txq_model); 4081 - vport_msg.rxq_model = cpu_to_le16(vport->rxq_model); 3986 + vport_msg.txq_model = cpu_to_le16(rsrc->txq_model); 3987 + vport_msg.rxq_model = cpu_to_le16(rsrc->rxq_model); 4082 3988 err = idpf_vport_calc_total_qs(vport->adapter, vport->idx, &vport_msg, 4083 3989 NULL); 4084 3990 if (err) 4085 3991 return err; 4086 3992 4087 - idpf_vport_init_num_qs(vport, &vport_msg); 4088 - idpf_vport_calc_num_q_groups(vport); 3993 + idpf_vport_init_num_qs(vport, &vport_msg, rsrc); 3994 + idpf_vport_calc_num_q_groups(rsrc); 4089 3995 4090 3996 return 0; 4091 3997 } ··· 4208 4112 return le32_to_cpu(vport_msg->vport_id); 4209 4113 } 4210 4114 4211 - static void idpf_set_mac_type(struct idpf_vport *vport, 4115 + static void idpf_set_mac_type(const u8 *default_mac_addr, 4212 4116 struct virtchnl2_mac_addr *mac_addr) 4213 4117 { 4214 4118 bool is_primary; 4215 4119 4216 - is_primary = ether_addr_equal(vport->default_mac_addr, mac_addr->addr); 4120 + is_primary = ether_addr_equal(default_mac_addr, mac_addr->addr); 4217 4121 mac_addr->type = is_primary ? VIRTCHNL2_MAC_ADDR_PRIMARY : 4218 4122 VIRTCHNL2_MAC_ADDR_EXTRA; 4219 4123 } ··· 4289 4193 4290 4194 /** 4291 4195 * idpf_add_del_mac_filters - Add/del mac filters 4292 - * @vport: Virtual port data structure 4293 - * @np: Netdev private structure 4196 + * @adapter: adapter pointer used to send virtchnl message 4197 + * @vport_config: persistent vport structure to get the MAC filter list 4198 + * @default_mac_addr: default MAC address to compare with 4199 + * @vport_id: vport identifier used while preparing the virtchnl message 4294 4200 * @add: Add or delete flag 4295 4201 * @async: Don't wait for return message 4296 4202 * 4297 - * Returns 0 on success, error on failure. 4203 + * Return: 0 on success, error on failure. 4298 4204 **/ 4299 - int idpf_add_del_mac_filters(struct idpf_vport *vport, 4300 - struct idpf_netdev_priv *np, 4205 + int idpf_add_del_mac_filters(struct idpf_adapter *adapter, 4206 + struct idpf_vport_config *vport_config, 4207 + const u8 *default_mac_addr, u32 vport_id, 4301 4208 bool add, bool async) 4302 4209 { 4303 4210 struct virtchnl2_mac_addr_list *ma_list __free(kfree) = NULL; 4304 4211 struct virtchnl2_mac_addr *mac_addr __free(kfree) = NULL; 4305 - struct idpf_adapter *adapter = np->adapter; 4306 4212 struct idpf_vc_xn_params xn_params = {}; 4307 - struct idpf_vport_config *vport_config; 4308 4213 u32 num_msgs, total_filters = 0; 4309 4214 struct idpf_mac_filter *f; 4310 4215 ssize_t reply_sz; ··· 4317 4220 xn_params.async = async; 4318 4221 xn_params.async_handler = idpf_mac_filter_async_handler; 4319 4222 4320 - vport_config = adapter->vport_config[np->vport_idx]; 4321 4223 spin_lock_bh(&vport_config->mac_filter_list_lock); 4322 4224 4323 4225 /* Find the number of newly added filters */ ··· 4347 4251 list) { 4348 4252 if (add && f->add) { 4349 4253 ether_addr_copy(mac_addr[i].addr, f->macaddr); 4350 - idpf_set_mac_type(vport, &mac_addr[i]); 4254 + idpf_set_mac_type(default_mac_addr, &mac_addr[i]); 4351 4255 i++; 4352 4256 f->add = false; 4353 4257 if (i == total_filters) ··· 4355 4259 } 4356 4260 if (!add && f->remove) { 4357 4261 ether_addr_copy(mac_addr[i].addr, f->macaddr); 4358 - idpf_set_mac_type(vport, &mac_addr[i]); 4262 + idpf_set_mac_type(default_mac_addr, &mac_addr[i]); 4359 4263 i++; 4360 4264 f->remove = false; 4361 4265 if (i == total_filters) ··· 4387 4291 memset(ma_list, 0, buf_size); 4388 4292 } 4389 4293 4390 - ma_list->vport_id = cpu_to_le32(np->vport_id); 4294 + ma_list->vport_id = cpu_to_le32(vport_id); 4391 4295 ma_list->num_mac_addr = cpu_to_le16(num_entries); 4392 4296 memcpy(ma_list->mac_addr_list, &mac_addr[k], entries_size); 4393 4297
+58 -26
drivers/net/ethernet/intel/idpf/idpf_virtchnl.h
··· 92 92 struct idpf_vec_regs; 93 93 struct idpf_vport; 94 94 struct idpf_vport_max_q; 95 + struct idpf_vport_config; 95 96 struct idpf_vport_user_config_data; 96 97 97 98 ssize_t idpf_vc_xn_exec(struct idpf_adapter *adapter, ··· 102 101 int idpf_vc_core_init(struct idpf_adapter *adapter); 103 102 void idpf_vc_core_deinit(struct idpf_adapter *adapter); 104 103 105 - int idpf_get_reg_intr_vecs(struct idpf_vport *vport, 104 + int idpf_get_reg_intr_vecs(struct idpf_adapter *adapter, 106 105 struct idpf_vec_regs *reg_vals); 107 - int idpf_queue_reg_init(struct idpf_vport *vport); 108 - int idpf_vport_queue_ids_init(struct idpf_vport *vport); 106 + int idpf_queue_reg_init(struct idpf_vport *vport, 107 + struct idpf_q_vec_rsrc *rsrc, 108 + struct idpf_queue_id_reg_info *chunks); 109 + int idpf_vport_queue_ids_init(struct idpf_vport *vport, 110 + struct idpf_q_vec_rsrc *rsrc, 111 + struct idpf_queue_id_reg_info *chunks); 112 + static inline void 113 + idpf_vport_deinit_queue_reg_chunks(struct idpf_vport_config *vport_cfg) 114 + { 115 + kfree(vport_cfg->qid_reg_info.queue_chunks); 116 + vport_cfg->qid_reg_info.queue_chunks = NULL; 117 + } 109 118 110 119 bool idpf_vport_is_cap_ena(struct idpf_vport *vport, u16 flag); 111 120 bool idpf_sideband_flow_type_ena(struct idpf_vport *vport, u32 flow_type); ··· 123 112 struct ethtool_rx_flow_spec *fsp); 124 113 unsigned int idpf_fsteer_max_rules(struct idpf_vport *vport); 125 114 126 - int idpf_recv_mb_msg(struct idpf_adapter *adapter); 127 - int idpf_send_mb_msg(struct idpf_adapter *adapter, u32 op, 128 - u16 msg_size, u8 *msg, u16 cookie); 115 + int idpf_recv_mb_msg(struct idpf_adapter *adapter, struct idpf_ctlq_info *arq); 116 + int idpf_send_mb_msg(struct idpf_adapter *adapter, struct idpf_ctlq_info *asq, 117 + u32 op, u16 msg_size, u8 *msg, u16 cookie); 129 118 130 119 struct idpf_queue_ptr { 131 120 enum virtchnl2_queue_type type; ··· 138 127 }; 139 128 140 129 struct idpf_queue_set { 141 - struct idpf_vport *vport; 130 + struct idpf_adapter *adapter; 131 + struct idpf_q_vec_rsrc *qv_rsrc; 132 + u32 vport_id; 142 133 143 134 u32 num; 144 135 struct idpf_queue_ptr qs[] __counted_by(num); 145 136 }; 146 137 147 - struct idpf_queue_set *idpf_alloc_queue_set(struct idpf_vport *vport, u32 num); 138 + struct idpf_queue_set *idpf_alloc_queue_set(struct idpf_adapter *adapter, 139 + struct idpf_q_vec_rsrc *rsrc, 140 + u32 vport_id, u32 num); 148 141 149 142 int idpf_send_enable_queue_set_msg(const struct idpf_queue_set *qs); 150 143 int idpf_send_disable_queue_set_msg(const struct idpf_queue_set *qs); 151 144 int idpf_send_config_queue_set_msg(const struct idpf_queue_set *qs); 152 145 153 146 int idpf_send_disable_queues_msg(struct idpf_vport *vport); 154 - int idpf_send_config_queues_msg(struct idpf_vport *vport); 155 147 int idpf_send_enable_queues_msg(struct idpf_vport *vport); 148 + int idpf_send_config_queues_msg(struct idpf_adapter *adapter, 149 + struct idpf_q_vec_rsrc *rsrc, 150 + u32 vport_id); 156 151 157 - void idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q); 152 + int idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q); 158 153 u32 idpf_get_vport_id(struct idpf_vport *vport); 159 154 int idpf_send_create_vport_msg(struct idpf_adapter *adapter, 160 155 struct idpf_vport_max_q *max_q); 161 - int idpf_send_destroy_vport_msg(struct idpf_vport *vport); 162 - int idpf_send_enable_vport_msg(struct idpf_vport *vport); 163 - int idpf_send_disable_vport_msg(struct idpf_vport *vport); 156 + int idpf_send_destroy_vport_msg(struct idpf_adapter *adapter, u32 vport_id); 157 + int idpf_send_enable_vport_msg(struct idpf_adapter *adapter, u32 vport_id); 158 + int idpf_send_disable_vport_msg(struct idpf_adapter *adapter, u32 vport_id); 164 159 165 - int idpf_vport_adjust_qs(struct idpf_vport *vport); 160 + int idpf_vport_adjust_qs(struct idpf_vport *vport, 161 + struct idpf_q_vec_rsrc *rsrc); 166 162 int idpf_vport_alloc_max_qs(struct idpf_adapter *adapter, 167 163 struct idpf_vport_max_q *max_q); 168 164 void idpf_vport_dealloc_max_qs(struct idpf_adapter *adapter, 169 165 struct idpf_vport_max_q *max_q); 170 - int idpf_send_add_queues_msg(const struct idpf_vport *vport, u16 num_tx_q, 171 - u16 num_complq, u16 num_rx_q, u16 num_rx_bufq); 172 - int idpf_send_delete_queues_msg(struct idpf_vport *vport); 166 + int idpf_send_add_queues_msg(struct idpf_adapter *adapter, 167 + struct idpf_vport_config *vport_config, 168 + struct idpf_q_vec_rsrc *rsrc, 169 + u32 vport_id); 170 + int idpf_send_delete_queues_msg(struct idpf_adapter *adapter, 171 + struct idpf_queue_id_reg_info *chunks, 172 + u32 vport_id); 173 173 174 - int idpf_vport_alloc_vec_indexes(struct idpf_vport *vport); 174 + int idpf_vport_alloc_vec_indexes(struct idpf_vport *vport, 175 + struct idpf_q_vec_rsrc *rsrc); 175 176 int idpf_get_vec_ids(struct idpf_adapter *adapter, 176 177 u16 *vecids, int num_vecids, 177 178 struct virtchnl2_vector_chunks *chunks); 178 179 int idpf_send_alloc_vectors_msg(struct idpf_adapter *adapter, u16 num_vectors); 179 180 int idpf_send_dealloc_vectors_msg(struct idpf_adapter *adapter); 180 - int idpf_send_map_unmap_queue_vector_msg(struct idpf_vport *vport, bool map); 181 + int idpf_send_map_unmap_queue_vector_msg(struct idpf_adapter *adapter, 182 + struct idpf_q_vec_rsrc *rsrc, 183 + u32 vport_id, 184 + bool map); 181 185 182 - int idpf_add_del_mac_filters(struct idpf_vport *vport, 183 - struct idpf_netdev_priv *np, 186 + int idpf_add_del_mac_filters(struct idpf_adapter *adapter, 187 + struct idpf_vport_config *vport_config, 188 + const u8 *default_mac_addr, u32 vport_id, 184 189 bool add, bool async); 185 190 int idpf_set_promiscuous(struct idpf_adapter *adapter, 186 191 struct idpf_vport_user_config_data *config_data, 187 192 u32 vport_id); 188 193 int idpf_check_supported_desc_ids(struct idpf_vport *vport); 189 - int idpf_send_get_rx_ptype_msg(struct idpf_vport *vport); 190 - int idpf_send_ena_dis_loopback_msg(struct idpf_vport *vport); 191 - int idpf_send_get_stats_msg(struct idpf_vport *vport); 194 + int idpf_send_ena_dis_loopback_msg(struct idpf_adapter *adapter, u32 vport_id, 195 + bool loopback_ena); 196 + int idpf_send_get_stats_msg(struct idpf_netdev_priv *np, 197 + struct idpf_port_stats *port_stats); 192 198 int idpf_send_set_sriov_vfs_msg(struct idpf_adapter *adapter, u16 num_vfs); 193 - int idpf_send_get_set_rss_key_msg(struct idpf_vport *vport, bool get); 194 - int idpf_send_get_set_rss_lut_msg(struct idpf_vport *vport, bool get); 199 + int idpf_send_get_set_rss_key_msg(struct idpf_adapter *adapter, 200 + struct idpf_rss_data *rss_data, 201 + u32 vport_id, bool get); 202 + int idpf_send_get_set_rss_lut_msg(struct idpf_adapter *adapter, 203 + struct idpf_rss_data *rss_data, 204 + u32 vport_id, bool get); 195 205 void idpf_vc_xn_shutdown(struct idpf_vc_xn_manager *vcxn_mngr); 196 206 int idpf_idc_rdma_vc_send_sync(struct iidc_rdma_core_dev_info *cdev_info, 197 207 u8 *send_msg, u16 msg_size,
+28 -20
drivers/net/ethernet/intel/idpf/xdp.c
··· 6 6 #include "xdp.h" 7 7 #include "xsk.h" 8 8 9 - static int idpf_rxq_for_each(const struct idpf_vport *vport, 9 + static int idpf_rxq_for_each(const struct idpf_q_vec_rsrc *rsrc, 10 10 int (*fn)(struct idpf_rx_queue *rxq, void *arg), 11 11 void *arg) 12 12 { 13 - bool splitq = idpf_is_queue_model_split(vport->rxq_model); 13 + bool splitq = idpf_is_queue_model_split(rsrc->rxq_model); 14 14 15 - if (!vport->rxq_grps) 15 + if (!rsrc->rxq_grps) 16 16 return -ENETDOWN; 17 17 18 - for (u32 i = 0; i < vport->num_rxq_grp; i++) { 19 - const struct idpf_rxq_group *rx_qgrp = &vport->rxq_grps[i]; 18 + for (u32 i = 0; i < rsrc->num_rxq_grp; i++) { 19 + const struct idpf_rxq_group *rx_qgrp = &rsrc->rxq_grps[i]; 20 20 u32 num_rxq; 21 21 22 22 if (splitq) ··· 45 45 static int __idpf_xdp_rxq_info_init(struct idpf_rx_queue *rxq, void *arg) 46 46 { 47 47 const struct idpf_vport *vport = rxq->q_vector->vport; 48 - bool split = idpf_is_queue_model_split(vport->rxq_model); 48 + const struct idpf_q_vec_rsrc *rsrc; 49 + bool split; 49 50 int err; 50 51 51 52 err = __xdp_rxq_info_reg(&rxq->xdp_rxq, vport->netdev, rxq->idx, ··· 54 53 rxq->rx_buf_size); 55 54 if (err) 56 55 return err; 56 + 57 + rsrc = &vport->dflt_qv_rsrc; 58 + split = idpf_is_queue_model_split(rsrc->rxq_model); 57 59 58 60 if (idpf_queue_has(XSK, rxq)) { 59 61 err = xdp_rxq_info_reg_mem_model(&rxq->xdp_rxq, ··· 74 70 if (!split) 75 71 return 0; 76 72 77 - rxq->xdpsqs = &vport->txqs[vport->xdp_txq_offset]; 73 + rxq->xdpsqs = &vport->txqs[rsrc->xdp_txq_offset]; 78 74 rxq->num_xdp_txq = vport->num_xdp_txq; 79 75 80 76 return 0; ··· 90 86 return __idpf_xdp_rxq_info_init(rxq, NULL); 91 87 } 92 88 93 - int idpf_xdp_rxq_info_init_all(const struct idpf_vport *vport) 89 + int idpf_xdp_rxq_info_init_all(const struct idpf_q_vec_rsrc *rsrc) 94 90 { 95 - return idpf_rxq_for_each(vport, __idpf_xdp_rxq_info_init, NULL); 91 + return idpf_rxq_for_each(rsrc, __idpf_xdp_rxq_info_init, NULL); 96 92 } 97 93 98 94 static int __idpf_xdp_rxq_info_deinit(struct idpf_rx_queue *rxq, void *arg) ··· 115 111 __idpf_xdp_rxq_info_deinit(rxq, (void *)(size_t)model); 116 112 } 117 113 118 - void idpf_xdp_rxq_info_deinit_all(const struct idpf_vport *vport) 114 + void idpf_xdp_rxq_info_deinit_all(const struct idpf_q_vec_rsrc *rsrc) 119 115 { 120 - idpf_rxq_for_each(vport, __idpf_xdp_rxq_info_deinit, 121 - (void *)(size_t)vport->rxq_model); 116 + idpf_rxq_for_each(rsrc, __idpf_xdp_rxq_info_deinit, 117 + (void *)(size_t)rsrc->rxq_model); 122 118 } 123 119 124 120 static int idpf_xdp_rxq_assign_prog(struct idpf_rx_queue *rxq, void *arg) ··· 136 132 return 0; 137 133 } 138 134 139 - void idpf_xdp_copy_prog_to_rqs(const struct idpf_vport *vport, 135 + void idpf_xdp_copy_prog_to_rqs(const struct idpf_q_vec_rsrc *rsrc, 140 136 struct bpf_prog *xdp_prog) 141 137 { 142 - idpf_rxq_for_each(vport, idpf_xdp_rxq_assign_prog, xdp_prog); 138 + idpf_rxq_for_each(rsrc, idpf_xdp_rxq_assign_prog, xdp_prog); 143 139 } 144 140 145 141 static void idpf_xdp_tx_timer(struct work_struct *work); ··· 169 165 } 170 166 171 167 dev = vport->netdev; 172 - sqs = vport->xdp_txq_offset; 168 + sqs = vport->dflt_qv_rsrc.xdp_txq_offset; 173 169 174 170 for (u32 i = sqs; i < vport->num_txq; i++) { 175 171 struct idpf_tx_queue *xdpsq = vport->txqs[i]; ··· 206 202 return; 207 203 208 204 dev = vport->netdev; 209 - sqs = vport->xdp_txq_offset; 205 + sqs = vport->dflt_qv_rsrc.xdp_txq_offset; 210 206 211 207 for (u32 i = sqs; i < vport->num_txq; i++) { 212 208 struct idpf_tx_queue *xdpsq = vport->txqs[i]; ··· 362 358 { 363 359 const struct idpf_netdev_priv *np = netdev_priv(dev); 364 360 const struct idpf_vport *vport = np->vport; 361 + u32 xdp_txq_offset; 365 362 366 363 if (unlikely(!netif_carrier_ok(dev) || !vport->link_up)) 367 364 return -ENETDOWN; 368 365 366 + xdp_txq_offset = vport->dflt_qv_rsrc.xdp_txq_offset; 367 + 369 368 return libeth_xdp_xmit_do_bulk(dev, n, frames, flags, 370 - &vport->txqs[vport->xdp_txq_offset], 369 + &vport->txqs[xdp_txq_offset], 371 370 vport->num_xdp_txq, 372 371 idpf_xdp_xmit_flush_bulk, 373 372 idpf_xdp_tx_finalize); ··· 404 397 405 398 void idpf_xdp_set_features(const struct idpf_vport *vport) 406 399 { 407 - if (!idpf_is_queue_model_split(vport->rxq_model)) 400 + if (!idpf_is_queue_model_split(vport->dflt_qv_rsrc.rxq_model)) 408 401 return; 409 402 410 403 libeth_xdp_set_features_noredir(vport->netdev, &idpf_xdpmo, ··· 416 409 const struct netdev_bpf *xdp) 417 410 { 418 411 const struct idpf_netdev_priv *np = netdev_priv(vport->netdev); 412 + const struct idpf_q_vec_rsrc *rsrc = &vport->dflt_qv_rsrc; 419 413 struct bpf_prog *old, *prog = xdp->prog; 420 414 struct idpf_vport_config *cfg; 421 415 int ret; ··· 427 419 !test_bit(IDPF_VPORT_REG_NETDEV, cfg->flags) || 428 420 !!vport->xdp_prog == !!prog) { 429 421 if (test_bit(IDPF_VPORT_UP, np->state)) 430 - idpf_xdp_copy_prog_to_rqs(vport, prog); 422 + idpf_xdp_copy_prog_to_rqs(rsrc, prog); 431 423 432 424 old = xchg(&vport->xdp_prog, prog); 433 425 if (old) ··· 472 464 idpf_vport_ctrl_lock(dev); 473 465 vport = idpf_netdev_to_vport(dev); 474 466 475 - if (!idpf_is_queue_model_split(vport->txq_model)) 467 + if (!idpf_is_queue_model_split(vport->dflt_qv_rsrc.txq_model)) 476 468 goto notsupp; 477 469 478 470 switch (xdp->command) {
+3 -3
drivers/net/ethernet/intel/idpf/xdp.h
··· 9 9 #include "idpf_txrx.h" 10 10 11 11 int idpf_xdp_rxq_info_init(struct idpf_rx_queue *rxq); 12 - int idpf_xdp_rxq_info_init_all(const struct idpf_vport *vport); 12 + int idpf_xdp_rxq_info_init_all(const struct idpf_q_vec_rsrc *rsrc); 13 13 void idpf_xdp_rxq_info_deinit(struct idpf_rx_queue *rxq, u32 model); 14 - void idpf_xdp_rxq_info_deinit_all(const struct idpf_vport *vport); 15 - void idpf_xdp_copy_prog_to_rqs(const struct idpf_vport *vport, 14 + void idpf_xdp_rxq_info_deinit_all(const struct idpf_q_vec_rsrc *rsrc); 15 + void idpf_xdp_copy_prog_to_rqs(const struct idpf_q_vec_rsrc *rsrc, 16 16 struct bpf_prog *xdp_prog); 17 17 18 18 int idpf_xdpsqs_get(const struct idpf_vport *vport);
+7 -5
drivers/net/ethernet/intel/idpf/xsk.c
··· 26 26 static void idpf_xsk_setup_bufq(const struct idpf_vport *vport, 27 27 struct idpf_buf_queue *bufq) 28 28 { 29 + const struct idpf_q_vec_rsrc *rsrc = &vport->dflt_qv_rsrc; 29 30 struct xsk_buff_pool *pool; 30 31 u32 qid = U32_MAX; 31 32 32 - for (u32 i = 0; i < vport->num_rxq_grp; i++) { 33 - const struct idpf_rxq_group *grp = &vport->rxq_grps[i]; 33 + for (u32 i = 0; i < rsrc->num_rxq_grp; i++) { 34 + const struct idpf_rxq_group *grp = &rsrc->rxq_grps[i]; 34 35 35 - for (u32 j = 0; j < vport->num_bufqs_per_qgrp; j++) { 36 + for (u32 j = 0; j < rsrc->num_bufqs_per_qgrp; j++) { 36 37 if (&grp->splitq.bufq_sets[j].bufq == bufq) { 37 38 qid = grp->splitq.rxq_sets[0]->rxq.idx; 38 39 goto setup; ··· 62 61 if (!idpf_queue_has(XDP, txq)) 63 62 return; 64 63 65 - qid = txq->idx - vport->xdp_txq_offset; 64 + qid = txq->idx - vport->dflt_qv_rsrc.xdp_txq_offset; 66 65 67 66 pool = xsk_get_pool_from_qid(vport->netdev, qid); 68 67 if (!pool || !pool->dev) ··· 87 86 if (!idpf_queue_has(XDP, complq)) 88 87 return; 89 88 90 - qid = complq->txq_grp->txqs[0]->idx - vport->xdp_txq_offset; 89 + qid = complq->txq_grp->txqs[0]->idx - 90 + vport->dflt_qv_rsrc.xdp_txq_offset; 91 91 92 92 pool = xsk_get_pool_from_qid(vport->netdev, qid); 93 93 if (!pool || !pool->dev)