hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c
....@@ -1,33 +1,7 @@
1
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
12 /* QLogic qed NIC Driver
23 * Copyright (c) 2015-2017 QLogic Corporation
3
- *
4
- * This software is available to you under a choice of one of two
5
- * licenses. You may choose to be licensed under the terms of the GNU
6
- * General Public License (GPL) Version 2, available from the file
7
- * COPYING in the main directory of this source tree, or the
8
- * OpenIB.org BSD license below:
9
- *
10
- * Redistribution and use in source and binary forms, with or
11
- * without modification, are permitted provided that the following
12
- * conditions are met:
13
- *
14
- * - Redistributions of source code must retain the above
15
- * copyright notice, this list of conditions and the following
16
- * disclaimer.
17
- *
18
- * - Redistributions in binary form must reproduce the above
19
- * copyright notice, this list of conditions and the following
20
- * disclaimer in the documentation and /or other materials
21
- * provided with the distribution.
22
- *
23
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
- * SOFTWARE.
4
+ * Copyright (c) 2019-2020 Marvell International Ltd.
315 */
326
337 #include <linux/types.h>
....@@ -326,13 +300,14 @@
326300 struct qed_tunnel_info *p_tunn,
327301 bool allow_npar_tx_switch)
328302 {
303
+ struct outer_tag_config_struct *outer_tag_config;
329304 struct pf_start_ramrod_data *p_ramrod = NULL;
330305 u16 sb = qed_int_get_sp_sb_id(p_hwfn);
331306 u8 sb_index = p_hwfn->p_eq->eq_sb_index;
332307 struct qed_spq_entry *p_ent = NULL;
333308 struct qed_sp_init_data init_data;
334
- int rc = -EINVAL;
335309 u8 page_cnt, i;
310
+ int rc;
336311
337312 /* update initial eq producer */
338313 qed_eq_prod_update(p_hwfn,
....@@ -362,39 +337,40 @@
362337 else
363338 p_ramrod->mf_mode = MF_NPAR;
364339
365
- p_ramrod->outer_tag_config.outer_tag.tci =
366
- cpu_to_le16(p_hwfn->hw_info.ovlan);
340
+ outer_tag_config = &p_ramrod->outer_tag_config;
341
+ outer_tag_config->outer_tag.tci = cpu_to_le16(p_hwfn->hw_info.ovlan);
342
+
367343 if (test_bit(QED_MF_8021Q_TAGGING, &p_hwfn->cdev->mf_bits)) {
368
- p_ramrod->outer_tag_config.outer_tag.tpid = ETH_P_8021Q;
344
+ outer_tag_config->outer_tag.tpid = cpu_to_le16(ETH_P_8021Q);
369345 } else if (test_bit(QED_MF_8021AD_TAGGING, &p_hwfn->cdev->mf_bits)) {
370
- p_ramrod->outer_tag_config.outer_tag.tpid = ETH_P_8021AD;
371
- p_ramrod->outer_tag_config.enable_stag_pri_change = 1;
346
+ outer_tag_config->outer_tag.tpid = cpu_to_le16(ETH_P_8021AD);
347
+ outer_tag_config->enable_stag_pri_change = 1;
372348 }
373349
374
- p_ramrod->outer_tag_config.pri_map_valid = 1;
350
+ outer_tag_config->pri_map_valid = 1;
375351 for (i = 0; i < QED_MAX_PFC_PRIORITIES; i++)
376
- p_ramrod->outer_tag_config.inner_to_outer_pri_map[i] = i;
352
+ outer_tag_config->inner_to_outer_pri_map[i] = i;
377353
378354 /* enable_stag_pri_change should be set if port is in BD mode or,
379355 * UFP with Host Control mode.
380356 */
381357 if (test_bit(QED_MF_UFP_SPECIFIC, &p_hwfn->cdev->mf_bits)) {
382358 if (p_hwfn->ufp_info.pri_type == QED_UFP_PRI_OS)
383
- p_ramrod->outer_tag_config.enable_stag_pri_change = 1;
359
+ outer_tag_config->enable_stag_pri_change = 1;
384360 else
385
- p_ramrod->outer_tag_config.enable_stag_pri_change = 0;
361
+ outer_tag_config->enable_stag_pri_change = 0;
386362
387
- p_ramrod->outer_tag_config.outer_tag.tci |=
363
+ outer_tag_config->outer_tag.tci |=
388364 cpu_to_le16(((u16)p_hwfn->ufp_info.tc << 13));
389365 }
390366
391367 /* Place EQ address in RAMROD */
392368 DMA_REGPAIR_LE(p_ramrod->event_ring_pbl_addr,
393
- p_hwfn->p_eq->chain.pbl_sp.p_phys_table);
369
+ qed_chain_get_pbl_phys(&p_hwfn->p_eq->chain));
394370 page_cnt = (u8)qed_chain_get_page_cnt(&p_hwfn->p_eq->chain);
395371 p_ramrod->event_ring_num_pages = page_cnt;
396372 DMA_REGPAIR_LE(p_ramrod->consolid_q_pbl_addr,
397
- p_hwfn->p_consq->chain.pbl_sp.p_phys_table);
373
+ qed_chain_get_pbl_phys(&p_hwfn->p_consq->chain));
398374
399375 qed_tunn_set_pf_start_params(p_hwfn, p_tunn, &p_ramrod->tunnel_config);
400376
....@@ -432,7 +408,7 @@
432408
433409 DP_VERBOSE(p_hwfn, QED_MSG_SPQ,
434410 "Setting event_ring_sb [id %04x index %02x], outer_tag.tci [%d]\n",
435
- sb, sb_index, p_ramrod->outer_tag_config.outer_tag.tci);
411
+ sb, sb_index, outer_tag_config->outer_tag.tci);
436412
437413 rc = qed_spq_post(p_hwfn, p_ent, NULL);
438414
....@@ -447,7 +423,7 @@
447423 {
448424 struct qed_spq_entry *p_ent = NULL;
449425 struct qed_sp_init_data init_data;
450
- int rc = -EINVAL;
426
+ int rc;
451427
452428 /* Get SPQ entry */
453429 memset(&init_data, 0, sizeof(init_data));
....@@ -471,7 +447,7 @@
471447 {
472448 struct qed_spq_entry *p_ent = NULL;
473449 struct qed_sp_init_data init_data;
474
- int rc = -EOPNOTSUPP;
450
+ int rc;
475451
476452 if (p_hwfn->ufp_info.pri_type == QED_UFP_PRI_UNKNOWN) {
477453 DP_INFO(p_hwfn, "Invalid priority type %d\n",
....@@ -509,7 +485,7 @@
509485 {
510486 struct qed_spq_entry *p_ent = NULL;
511487 struct qed_sp_init_data init_data;
512
- int rc = -EINVAL;
488
+ int rc;
513489
514490 if (IS_VF(p_hwfn->cdev))
515491 return qed_vf_pf_tunnel_param_update(p_hwfn, p_tunn);
....@@ -546,7 +522,7 @@
546522 {
547523 struct qed_spq_entry *p_ent = NULL;
548524 struct qed_sp_init_data init_data;
549
- int rc = -EINVAL;
525
+ int rc;
550526
551527 /* Get SPQ entry */
552528 memset(&init_data, 0, sizeof(init_data));
....@@ -588,7 +564,7 @@
588564 {
589565 struct qed_spq_entry *p_ent = NULL;
590566 struct qed_sp_init_data init_data;
591
- int rc = -EINVAL;
567
+ int rc;
592568
593569 /* Get SPQ entry */
594570 memset(&init_data, 0, sizeof(init_data));
....@@ -604,6 +580,9 @@
604580
605581 p_ent->ramrod.pf_update.update_mf_vlan_flag = true;
606582 p_ent->ramrod.pf_update.mf_vlan = cpu_to_le16(p_hwfn->hw_info.ovlan);
583
+ if (test_bit(QED_MF_UFP_SPECIFIC, &p_hwfn->cdev->mf_bits))
584
+ p_ent->ramrod.pf_update.mf_vlan |=
585
+ cpu_to_le16(((u16)p_hwfn->ufp_info.tc << 13));
607586
608587 return qed_spq_post(p_hwfn, p_ent, NULL);
609588 }