1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (C) 2019-2021, Intel Corporation. */
4 #include "ice_vsi_vlan_lib.h"
9 static void print_invalid_tpid(struct ice_vsi *vsi, u16 tpid)
11 dev_err(ice_pf_to_dev(vsi->back), "%s %d specified invalid VLAN tpid 0x%04x\n",
12 ice_vsi_type_str(vsi->type), vsi->idx, tpid);
16 * validate_vlan - check if the ice_vlan passed in is valid
17 * @vsi: VSI used for printing error message
18 * @vlan: ice_vlan structure to validate
20 * Return true if the VLAN TPID is valid or if the VLAN TPID is 0 and the VLAN
21 * VID is 0, which allows for non-zero VLAN filters with the specified VLAN TPID
22 * and untagged VLAN 0 filters to be added to the prune list respectively.
24 static bool validate_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan)
26 if (vlan->tpid != ETH_P_8021Q && vlan->tpid != ETH_P_8021AD &&
27 vlan->tpid != ETH_P_QINQ1 && (vlan->tpid || vlan->vid)) {
28 print_invalid_tpid(vsi, vlan->tpid);
36 * ice_vsi_add_vlan - default add VLAN implementation for all VSI types
37 * @vsi: VSI being configured
38 * @vlan: VLAN filter to add
40 int ice_vsi_add_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan)
44 if (!validate_vlan(vsi, vlan))
47 err = ice_fltr_add_vlan(vsi, vlan);
48 if (err && err != -EEXIST) {
49 dev_err(ice_pf_to_dev(vsi->back), "Failure Adding VLAN %d on VSI %i, status %d\n",
50 vlan->vid, vsi->vsi_num, err);
59 * ice_vsi_del_vlan - default del VLAN implementation for all VSI types
60 * @vsi: VSI being configured
61 * @vlan: VLAN filter to delete
63 int ice_vsi_del_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan)
65 struct ice_pf *pf = vsi->back;
69 if (!validate_vlan(vsi, vlan))
72 dev = ice_pf_to_dev(pf);
74 err = ice_fltr_remove_vlan(vsi, vlan);
77 else if (err == -ENOENT || err == -EBUSY)
80 dev_err(dev, "Error removing VLAN %d on VSI %i error: %d\n",
81 vlan->vid, vsi->vsi_num, err);
87 * ice_vsi_manage_vlan_insertion - Manage VLAN insertion for the VSI for Tx
88 * @vsi: the VSI being changed
90 static int ice_vsi_manage_vlan_insertion(struct ice_vsi *vsi)
92 struct ice_hw *hw = &vsi->back->hw;
93 struct ice_vsi_ctx *ctxt;
96 ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
100 /* Here we are configuring the VSI to let the driver add VLAN tags by
101 * setting inner_vlan_flags to ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL. The actual VLAN tag
102 * insertion happens in the Tx hot path, in ice_tx_map.
104 ctxt->info.inner_vlan_flags = ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL;
106 /* Preserve existing VLAN strip setting */
107 ctxt->info.inner_vlan_flags |= (vsi->info.inner_vlan_flags &
108 ICE_AQ_VSI_INNER_VLAN_EMODE_M);
110 ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);
112 err = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
114 dev_err(ice_pf_to_dev(vsi->back), "update VSI for VLAN insert failed, err %d aq_err %s\n",
115 err, ice_aq_str(hw->adminq.sq_last_status));
119 vsi->info.inner_vlan_flags = ctxt->info.inner_vlan_flags;
126 * ice_vsi_manage_vlan_stripping - Manage VLAN stripping for the VSI for Rx
127 * @vsi: the VSI being changed
128 * @ena: boolean value indicating if this is a enable or disable request
130 static int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)
132 struct ice_hw *hw = &vsi->back->hw;
133 struct ice_vsi_ctx *ctxt;
136 /* do not allow modifying VLAN stripping when a port VLAN is configured
139 if (vsi->info.port_based_inner_vlan)
142 ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
146 /* Here we are configuring what the VSI should do with the VLAN tag in
147 * the Rx packet. We can either leave the tag in the packet or put it in
151 /* Strip VLAN tag from Rx packet and put it in the desc */
152 ctxt->info.inner_vlan_flags = ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH;
154 /* Disable stripping. Leave tag in packet */
155 ctxt->info.inner_vlan_flags = ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING;
157 /* Allow all packets untagged/tagged */
158 ctxt->info.inner_vlan_flags |= ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL;
160 ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);
162 err = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
164 dev_err(ice_pf_to_dev(vsi->back), "update VSI for VLAN strip failed, ena = %d err %d aq_err %s\n",
165 ena, err, ice_aq_str(hw->adminq.sq_last_status));
169 vsi->info.inner_vlan_flags = ctxt->info.inner_vlan_flags;
175 int ice_vsi_ena_inner_stripping(struct ice_vsi *vsi, const u16 tpid)
177 if (tpid != ETH_P_8021Q) {
178 print_invalid_tpid(vsi, tpid);
182 return ice_vsi_manage_vlan_stripping(vsi, true);
185 int ice_vsi_dis_inner_stripping(struct ice_vsi *vsi)
187 return ice_vsi_manage_vlan_stripping(vsi, false);
190 int ice_vsi_ena_inner_insertion(struct ice_vsi *vsi, const u16 tpid)
192 if (tpid != ETH_P_8021Q) {
193 print_invalid_tpid(vsi, tpid);
197 return ice_vsi_manage_vlan_insertion(vsi);
200 int ice_vsi_dis_inner_insertion(struct ice_vsi *vsi)
202 return ice_vsi_manage_vlan_insertion(vsi);
206 * __ice_vsi_set_inner_port_vlan - set port VLAN VSI context settings to enable a port VLAN
207 * @vsi: the VSI to update
208 * @pvid_info: VLAN ID and QoS used to set the PVID VSI context field
210 static int __ice_vsi_set_inner_port_vlan(struct ice_vsi *vsi, u16 pvid_info)
212 struct ice_hw *hw = &vsi->back->hw;
213 struct ice_aqc_vsi_props *info;
214 struct ice_vsi_ctx *ctxt;
217 ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
221 ctxt->info = vsi->info;
223 info->inner_vlan_flags = ICE_AQ_VSI_INNER_VLAN_TX_MODE_ACCEPTUNTAGGED |
224 ICE_AQ_VSI_INNER_VLAN_INSERT_PVID |
225 ICE_AQ_VSI_INNER_VLAN_EMODE_STR;
226 info->sw_flags2 |= ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;
228 info->port_based_inner_vlan = cpu_to_le16(pvid_info);
229 info->valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID |
230 ICE_AQ_VSI_PROP_SW_VALID);
232 ret = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
234 dev_info(ice_hw_to_dev(hw), "update VSI for port VLAN failed, err %d aq_err %s\n",
235 ret, ice_aq_str(hw->adminq.sq_last_status));
239 vsi->info.inner_vlan_flags = info->inner_vlan_flags;
240 vsi->info.sw_flags2 = info->sw_flags2;
241 vsi->info.port_based_inner_vlan = info->port_based_inner_vlan;
247 int ice_vsi_set_inner_port_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan)
251 if (vlan->tpid != ETH_P_8021Q)
257 port_vlan_info = vlan->vid | (vlan->prio << VLAN_PRIO_SHIFT);
259 return __ice_vsi_set_inner_port_vlan(vsi, port_vlan_info);
263 * ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI
264 * @vsi: VSI to enable or disable VLAN pruning on
265 * @ena: set to true to enable VLAN pruning and false to disable it
267 * returns 0 if VSI is updated, negative otherwise
269 static int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena)
271 struct ice_vsi_ctx *ctxt;
278 /* Don't enable VLAN pruning if the netdev is currently in promiscuous
279 * mode. VLAN pruning will be enabled when the interface exits
280 * promiscuous mode if any VLAN filters are active.
282 if (vsi->netdev && vsi->netdev->flags & IFF_PROMISC && ena)
286 ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
290 ctxt->info = vsi->info;
293 ctxt->info.sw_flags2 |= ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;
295 ctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;
297 ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SW_VALID);
299 status = ice_update_vsi(&pf->hw, vsi->idx, ctxt, NULL);
301 netdev_err(vsi->netdev, "%sabling VLAN pruning on VSI handle: %d, VSI HW ID: %d failed, err = %d, aq_err = %s\n",
302 ena ? "En" : "Dis", vsi->idx, vsi->vsi_num, status,
303 ice_aq_str(pf->hw.adminq.sq_last_status));
307 vsi->info.sw_flags2 = ctxt->info.sw_flags2;
317 int ice_vsi_ena_rx_vlan_filtering(struct ice_vsi *vsi)
319 return ice_cfg_vlan_pruning(vsi, true);
322 int ice_vsi_dis_rx_vlan_filtering(struct ice_vsi *vsi)
324 return ice_cfg_vlan_pruning(vsi, false);
327 static int ice_cfg_vlan_antispoof(struct ice_vsi *vsi, bool enable)
329 struct ice_vsi_ctx *ctx;
332 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
336 ctx->info.sec_flags = vsi->info.sec_flags;
337 ctx->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID);
340 ctx->info.sec_flags |= ICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA <<
341 ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S;
343 ctx->info.sec_flags &= ~(ICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA <<
344 ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S);
346 err = ice_update_vsi(&vsi->back->hw, vsi->idx, ctx, NULL);
348 dev_err(ice_pf_to_dev(vsi->back), "Failed to configure Tx VLAN anti-spoof %s for VSI %d, error %d\n",
349 enable ? "ON" : "OFF", vsi->vsi_num, err);
351 vsi->info.sec_flags = ctx->info.sec_flags;
358 int ice_vsi_ena_tx_vlan_filtering(struct ice_vsi *vsi)
360 return ice_cfg_vlan_antispoof(vsi, true);
363 int ice_vsi_dis_tx_vlan_filtering(struct ice_vsi *vsi)
365 return ice_cfg_vlan_antispoof(vsi, false);
369 * tpid_to_vsi_outer_vlan_type - convert from TPID to VSI context based tag_type
370 * @tpid: tpid used to translate into VSI context based tag_type
371 * @tag_type: output variable to hold the VSI context based tag type
373 static int tpid_to_vsi_outer_vlan_type(u16 tpid, u8 *tag_type)
377 *tag_type = ICE_AQ_VSI_OUTER_TAG_VLAN_8100;
380 *tag_type = ICE_AQ_VSI_OUTER_TAG_STAG;
383 *tag_type = ICE_AQ_VSI_OUTER_TAG_VLAN_9100;
394 * ice_vsi_ena_outer_stripping - enable outer VLAN stripping
395 * @vsi: VSI to configure
396 * @tpid: TPID to enable outer VLAN stripping for
398 * Enable outer VLAN stripping via VSI context. This function should only be
399 * used if DVM is supported. Also, this function should never be called directly
400 * as it should be part of ice_vsi_vlan_ops if it's needed.
402 * Since the VSI context only supports a single TPID for insertion and
403 * stripping, setting the TPID for stripping will affect the TPID for insertion.
404 * Callers need to be aware of this limitation.
406 * Only modify outer VLAN stripping settings and the VLAN TPID. Outer VLAN
407 * insertion settings are unmodified.
409 * This enables hardware to strip a VLAN tag with the specified TPID to be
410 * stripped from the packet and placed in the receive descriptor.
412 int ice_vsi_ena_outer_stripping(struct ice_vsi *vsi, u16 tpid)
414 struct ice_hw *hw = &vsi->back->hw;
415 struct ice_vsi_ctx *ctxt;
419 /* do not allow modifying VLAN stripping when a port VLAN is configured
422 if (vsi->info.port_based_outer_vlan)
425 if (tpid_to_vsi_outer_vlan_type(tpid, &tag_type))
428 ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
432 ctxt->info.valid_sections =
433 cpu_to_le16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);
434 /* clear current outer VLAN strip settings */
435 ctxt->info.outer_vlan_flags = vsi->info.outer_vlan_flags &
436 ~(ICE_AQ_VSI_OUTER_VLAN_EMODE_M | ICE_AQ_VSI_OUTER_TAG_TYPE_M);
437 ctxt->info.outer_vlan_flags |=
438 ((ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW_BOTH <<
439 ICE_AQ_VSI_OUTER_VLAN_EMODE_S) |
440 ((tag_type << ICE_AQ_VSI_OUTER_TAG_TYPE_S) &
441 ICE_AQ_VSI_OUTER_TAG_TYPE_M));
443 err = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
445 dev_err(ice_pf_to_dev(vsi->back), "update VSI for enabling outer VLAN stripping failed, err %d aq_err %s\n",
446 err, ice_aq_str(hw->adminq.sq_last_status));
448 vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags;
455 * ice_vsi_dis_outer_stripping - disable outer VLAN stripping
456 * @vsi: VSI to configure
458 * Disable outer VLAN stripping via VSI context. This function should only be
459 * used if DVM is supported. Also, this function should never be called directly
460 * as it should be part of ice_vsi_vlan_ops if it's needed.
462 * Only modify the outer VLAN stripping settings. The VLAN TPID and outer VLAN
463 * insertion settings are unmodified.
465 * This tells the hardware to not strip any VLAN tagged packets, thus leaving
466 * them in the packet. This enables software offloaded VLAN stripping and
467 * disables hardware offloaded VLAN stripping.
469 int ice_vsi_dis_outer_stripping(struct ice_vsi *vsi)
471 struct ice_hw *hw = &vsi->back->hw;
472 struct ice_vsi_ctx *ctxt;
475 if (vsi->info.port_based_outer_vlan)
478 ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
482 ctxt->info.valid_sections =
483 cpu_to_le16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);
484 /* clear current outer VLAN strip settings */
485 ctxt->info.outer_vlan_flags = vsi->info.outer_vlan_flags &
486 ~ICE_AQ_VSI_OUTER_VLAN_EMODE_M;
487 ctxt->info.outer_vlan_flags |= ICE_AQ_VSI_OUTER_VLAN_EMODE_NOTHING <<
488 ICE_AQ_VSI_OUTER_VLAN_EMODE_S;
490 err = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
492 dev_err(ice_pf_to_dev(vsi->back), "update VSI for disabling outer VLAN stripping failed, err %d aq_err %s\n",
493 err, ice_aq_str(hw->adminq.sq_last_status));
495 vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags;
502 * ice_vsi_ena_outer_insertion - enable outer VLAN insertion
503 * @vsi: VSI to configure
504 * @tpid: TPID to enable outer VLAN insertion for
506 * Enable outer VLAN insertion via VSI context. This function should only be
507 * used if DVM is supported. Also, this function should never be called directly
508 * as it should be part of ice_vsi_vlan_ops if it's needed.
510 * Since the VSI context only supports a single TPID for insertion and
511 * stripping, setting the TPID for insertion will affect the TPID for stripping.
512 * Callers need to be aware of this limitation.
514 * Only modify outer VLAN insertion settings and the VLAN TPID. Outer VLAN
515 * stripping settings are unmodified.
517 * This allows a VLAN tag with the specified TPID to be inserted in the transmit
520 int ice_vsi_ena_outer_insertion(struct ice_vsi *vsi, u16 tpid)
522 struct ice_hw *hw = &vsi->back->hw;
523 struct ice_vsi_ctx *ctxt;
527 if (vsi->info.port_based_outer_vlan)
530 if (tpid_to_vsi_outer_vlan_type(tpid, &tag_type))
533 ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
537 ctxt->info.valid_sections =
538 cpu_to_le16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);
539 /* clear current outer VLAN insertion settings */
540 ctxt->info.outer_vlan_flags = vsi->info.outer_vlan_flags &
541 ~(ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_INSERT |
542 ICE_AQ_VSI_OUTER_VLAN_BLOCK_TX_DESC |
543 ICE_AQ_VSI_OUTER_VLAN_TX_MODE_M |
544 ICE_AQ_VSI_OUTER_TAG_TYPE_M);
545 ctxt->info.outer_vlan_flags |=
546 ((ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ALL <<
547 ICE_AQ_VSI_OUTER_VLAN_TX_MODE_S) &
548 ICE_AQ_VSI_OUTER_VLAN_TX_MODE_M) |
549 ((tag_type << ICE_AQ_VSI_OUTER_TAG_TYPE_S) &
550 ICE_AQ_VSI_OUTER_TAG_TYPE_M);
552 err = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
554 dev_err(ice_pf_to_dev(vsi->back), "update VSI for enabling outer VLAN insertion failed, err %d aq_err %s\n",
555 err, ice_aq_str(hw->adminq.sq_last_status));
557 vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags;
564 * ice_vsi_dis_outer_insertion - disable outer VLAN insertion
565 * @vsi: VSI to configure
567 * Disable outer VLAN insertion via VSI context. This function should only be
568 * used if DVM is supported. Also, this function should never be called directly
569 * as it should be part of ice_vsi_vlan_ops if it's needed.
571 * Only modify the outer VLAN insertion settings. The VLAN TPID and outer VLAN
572 * settings are unmodified.
574 * This tells the hardware to not allow any VLAN tagged packets in the transmit
575 * descriptor. This enables software offloaded VLAN insertion and disables
576 * hardware offloaded VLAN insertion.
578 int ice_vsi_dis_outer_insertion(struct ice_vsi *vsi)
580 struct ice_hw *hw = &vsi->back->hw;
581 struct ice_vsi_ctx *ctxt;
584 if (vsi->info.port_based_outer_vlan)
587 ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
591 ctxt->info.valid_sections =
592 cpu_to_le16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);
593 /* clear current outer VLAN insertion settings */
594 ctxt->info.outer_vlan_flags = vsi->info.outer_vlan_flags &
595 ~(ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_INSERT |
596 ICE_AQ_VSI_OUTER_VLAN_TX_MODE_M);
597 ctxt->info.outer_vlan_flags |=
598 ICE_AQ_VSI_OUTER_VLAN_BLOCK_TX_DESC |
599 ((ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ALL <<
600 ICE_AQ_VSI_OUTER_VLAN_TX_MODE_S) &
601 ICE_AQ_VSI_OUTER_VLAN_TX_MODE_M);
603 err = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
605 dev_err(ice_pf_to_dev(vsi->back), "update VSI for disabling outer VLAN insertion failed, err %d aq_err %s\n",
606 err, ice_aq_str(hw->adminq.sq_last_status));
608 vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags;
615 * __ice_vsi_set_outer_port_vlan - set the outer port VLAN and related settings
616 * @vsi: VSI to configure
617 * @vlan_info: packed u16 that contains the VLAN prio and ID
618 * @tpid: TPID of the port VLAN
620 * Set the port VLAN prio, ID, and TPID.
622 * Enable VLAN pruning so the VSI doesn't receive any traffic that doesn't match
623 * a VLAN prune rule. The caller should take care to add a VLAN prune rule that
624 * matches the port VLAN ID and TPID.
626 * Tell hardware to strip outer VLAN tagged packets on receive and don't put
627 * them in the receive descriptor. VSI(s) in port VLANs should not be aware of
628 * the port VLAN ID or TPID they are assigned to.
630 * Tell hardware to prevent outer VLAN tag insertion on transmit and only allow
631 * untagged outer packets from the transmit descriptor.
633 * Also, tell the hardware to insert the port VLAN on transmit.
636 __ice_vsi_set_outer_port_vlan(struct ice_vsi *vsi, u16 vlan_info, u16 tpid)
638 struct ice_hw *hw = &vsi->back->hw;
639 struct ice_vsi_ctx *ctxt;
643 if (tpid_to_vsi_outer_vlan_type(tpid, &tag_type))
646 ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
650 ctxt->info = vsi->info;
652 ctxt->info.sw_flags2 |= ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;
654 ctxt->info.port_based_outer_vlan = cpu_to_le16(vlan_info);
655 ctxt->info.outer_vlan_flags =
656 (ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW <<
657 ICE_AQ_VSI_OUTER_VLAN_EMODE_S) |
658 ((tag_type << ICE_AQ_VSI_OUTER_TAG_TYPE_S) &
659 ICE_AQ_VSI_OUTER_TAG_TYPE_M) |
660 ICE_AQ_VSI_OUTER_VLAN_BLOCK_TX_DESC |
661 (ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ACCEPTUNTAGGED <<
662 ICE_AQ_VSI_OUTER_VLAN_TX_MODE_S) |
663 ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_INSERT;
665 ctxt->info.valid_sections =
666 cpu_to_le16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID |
667 ICE_AQ_VSI_PROP_SW_VALID);
669 err = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
671 dev_err(ice_pf_to_dev(vsi->back), "update VSI for setting outer port based VLAN failed, err %d aq_err %s\n",
672 err, ice_aq_str(hw->adminq.sq_last_status));
674 vsi->info.port_based_outer_vlan = ctxt->info.port_based_outer_vlan;
675 vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags;
676 vsi->info.sw_flags2 = ctxt->info.sw_flags2;
684 * ice_vsi_set_outer_port_vlan - public version of __ice_vsi_set_outer_port_vlan
685 * @vsi: VSI to configure
686 * @vlan: ice_vlan structure used to set the port VLAN
688 * Set the outer port VLAN via VSI context. This function should only be
689 * used if DVM is supported. Also, this function should never be called directly
690 * as it should be part of ice_vsi_vlan_ops if it's needed.
692 * This function does not support clearing the port VLAN as there is currently
693 * no use case for this.
695 * Use the ice_vlan structure passed in to set this VSI in a port VLAN.
697 int ice_vsi_set_outer_port_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan)
701 if (vlan->prio > (VLAN_PRIO_MASK >> VLAN_PRIO_SHIFT))
704 port_vlan_info = vlan->vid | (vlan->prio << VLAN_PRIO_SHIFT);
706 return __ice_vsi_set_outer_port_vlan(vsi, port_vlan_info, vlan->tpid);