Skip to content

Commit 90bc8e0

Browse files
kubalewskianguy11
authored andcommitted
i40e: Add hardware configuration for software based DCB
Add registers and definitions required for applying DCB related hardware configuration. Add functions responsible for calculating and setting proper hardware configuration values for software based DCB functionality. Add function responsible for invoking Admin Queue command, which results in applying new DCB configuration to the hardware. Update copyright dates as appropriate. Software based DCB is a brand-new feature in i40e driver. Before, DCB was implemented by Firmware LLDP agent only. The agent was responsible for handling incoming DCB-related LLDP frames and applying received DCB configuration to hardware. New communication channel between software and hardware is required for software driver. It must be able to calculate and configure all the registers related for DCB feature. Signed-off-by: Aleksandr Loktionov <[email protected]> Signed-off-by: Arkadiusz Kubalewski <[email protected]> Tested-by: Tony Brelinski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent dc9d875 commit 90bc8e0

File tree

7 files changed

+1365
-13
lines changed

7 files changed

+1365
-13
lines changed

drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
2-
/* Copyright(c) 2013 - 2018 Intel Corporation. */
2+
/* Copyright(c) 2013 - 2021 Intel Corporation. */
33

44
#ifndef _I40E_ADMINQ_CMD_H_
55
#define _I40E_ADMINQ_CMD_H_
@@ -1080,6 +1080,7 @@ struct i40e_aqc_add_remove_control_packet_filter {
10801080
#define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC 0x0001
10811081
#define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP 0x0002
10821082
#define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TX 0x0008
1083+
#define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_RX 0x0000
10831084
__le16 seid;
10841085
__le16 queue;
10851086
u8 reserved[2];
@@ -2184,6 +2185,14 @@ I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_get_cee_dcb_cfg_resp);
21842185
* Used to replace the local MIB of a given LLDP agent. e.g. DCBx
21852186
*/
21862187
struct i40e_aqc_lldp_set_local_mib {
2188+
#define SET_LOCAL_MIB_AC_TYPE_DCBX_SHIFT 0
2189+
#define SET_LOCAL_MIB_AC_TYPE_DCBX_MASK (1 << \
2190+
SET_LOCAL_MIB_AC_TYPE_DCBX_SHIFT)
2191+
#define SET_LOCAL_MIB_AC_TYPE_LOCAL_MIB 0x0
2192+
#define SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_SHIFT (1)
2193+
#define SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_MASK (1 << \
2194+
SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_SHIFT)
2195+
#define SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS 0x1
21872196
u8 type;
21882197
u8 reserved0;
21892198
__le16 length;

drivers/net/ethernet/intel/i40e/i40e_common.c

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2-
/* Copyright(c) 2013 - 2018 Intel Corporation. */
2+
/* Copyright(c) 2013 - 2021 Intel Corporation. */
33

44
#include "i40e.h"
55
#include "i40e_type.h"
@@ -3661,6 +3661,46 @@ i40e_status i40e_aq_get_lldp_mib(struct i40e_hw *hw, u8 bridge_type,
36613661
return status;
36623662
}
36633663

3664+
/**
3665+
* i40e_aq_set_lldp_mib - Set the LLDP MIB
3666+
* @hw: pointer to the hw struct
3667+
* @mib_type: Local, Remote or both Local and Remote MIBs
3668+
* @buff: pointer to a user supplied buffer to store the MIB block
3669+
* @buff_size: size of the buffer (in bytes)
3670+
* @cmd_details: pointer to command details structure or NULL
3671+
*
3672+
* Set the LLDP MIB.
3673+
**/
3674+
enum i40e_status_code
3675+
i40e_aq_set_lldp_mib(struct i40e_hw *hw,
3676+
u8 mib_type, void *buff, u16 buff_size,
3677+
struct i40e_asq_cmd_details *cmd_details)
3678+
{
3679+
struct i40e_aqc_lldp_set_local_mib *cmd;
3680+
enum i40e_status_code status;
3681+
struct i40e_aq_desc desc;
3682+
3683+
cmd = (struct i40e_aqc_lldp_set_local_mib *)&desc.params.raw;
3684+
if (buff_size == 0 || !buff)
3685+
return I40E_ERR_PARAM;
3686+
3687+
i40e_fill_default_direct_cmd_desc(&desc,
3688+
i40e_aqc_opc_lldp_set_local_mib);
3689+
/* Indirect Command */
3690+
desc.flags |= cpu_to_le16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
3691+
if (buff_size > I40E_AQ_LARGE_BUF)
3692+
desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_LB);
3693+
desc.datalen = cpu_to_le16(buff_size);
3694+
3695+
cmd->type = mib_type;
3696+
cmd->length = cpu_to_le16(buff_size);
3697+
cmd->address_high = cpu_to_le32(upper_32_bits((uintptr_t)buff));
3698+
cmd->address_low = cpu_to_le32(lower_32_bits((uintptr_t)buff));
3699+
3700+
status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
3701+
return status;
3702+
}
3703+
36643704
/**
36653705
* i40e_aq_cfg_lldp_mib_change_event
36663706
* @hw: pointer to the hw struct
@@ -4479,6 +4519,29 @@ static i40e_status i40e_aq_alternate_read(struct i40e_hw *hw,
44794519
return status;
44804520
}
44814521

4522+
/**
4523+
* i40e_aq_suspend_port_tx
4524+
* @hw: pointer to the hardware structure
4525+
* @seid: port seid
4526+
* @cmd_details: pointer to command details structure or NULL
4527+
*
4528+
* Suspend port's Tx traffic
4529+
**/
4530+
i40e_status i40e_aq_suspend_port_tx(struct i40e_hw *hw, u16 seid,
4531+
struct i40e_asq_cmd_details *cmd_details)
4532+
{
4533+
struct i40e_aqc_tx_sched_ind *cmd;
4534+
struct i40e_aq_desc desc;
4535+
i40e_status status;
4536+
4537+
cmd = (struct i40e_aqc_tx_sched_ind *)&desc.params.raw;
4538+
i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_suspend_port_tx);
4539+
cmd->vsi_seid = cpu_to_le16(seid);
4540+
status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
4541+
4542+
return status;
4543+
}
4544+
44824545
/**
44834546
* i40e_aq_resume_port_tx
44844547
* @hw: pointer to the hardware structure

0 commit comments

Comments
 (0)