Skip to content

Commit e94d447

Browse files
refactormanJeff Kirsher
authored andcommitted
ice: Implement filter sync, NDO operations and bump version
This patch implements multiple pieces of functionality: 1. Added ice_vsi_sync_filters, which is called through the service task to push filter updates to the hardware. 2. Add support to enable/disable promiscuous mode on an interface. Enabling/disabling promiscuous mode on an interface results in addition/removal of a promisc filter rule through ice_vsi_sync_filters. 3. Implement handlers for ndo_set_mac_address, ndo_change_mtu, ndo_poll_controller and ndo_set_rx_mode. This patch also marks the end of the driver addition by bumping up the driver version. Signed-off-by: Anirudh Venkataramanan <[email protected]> Tested-by: Tony Brelinski <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 0b28b70 commit e94d447

File tree

9 files changed

+728
-1
lines changed

9 files changed

+728
-1
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,20 @@ enum ice_state {
125125
__ICE_SUSPENDED, /* set on module remove path */
126126
__ICE_RESET_FAILED, /* set by reset/rebuild */
127127
__ICE_ADMINQ_EVENT_PENDING,
128+
__ICE_FLTR_OVERFLOW_PROMISC,
128129
__ICE_CFG_BUSY,
129130
__ICE_SERVICE_SCHED,
130131
__ICE_STATE_NBITS /* must be last */
131132
};
132133

134+
enum ice_vsi_flags {
135+
ICE_VSI_FLAG_UMAC_FLTR_CHANGED,
136+
ICE_VSI_FLAG_MMAC_FLTR_CHANGED,
137+
ICE_VSI_FLAG_VLAN_FLTR_CHANGED,
138+
ICE_VSI_FLAG_PROMISC_CHANGED,
139+
ICE_VSI_FLAG_NBITS /* must be last */
140+
};
141+
133142
/* struct that defines a VSI, associated with a dev */
134143
struct ice_vsi {
135144
struct net_device *netdev;
@@ -144,7 +153,9 @@ struct ice_vsi {
144153

145154
u64 tx_linearize;
146155
DECLARE_BITMAP(state, __ICE_STATE_NBITS);
156+
DECLARE_BITMAP(flags, ICE_VSI_FLAG_NBITS);
147157
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
158+
unsigned int current_netdev_flags;
148159
u32 tx_restart;
149160
u32 tx_busy;
150161
u32 rx_buf_failed;
@@ -175,6 +186,9 @@ struct ice_vsi {
175186
struct ice_eth_stats eth_stats;
176187
struct ice_eth_stats eth_stats_prev;
177188

189+
struct list_head tmp_sync_list; /* MAC filters to be synced */
190+
struct list_head tmp_unsync_list; /* MAC filters to be unsynced */
191+
178192
bool irqs_ready;
179193
bool current_isup; /* Sync 'link up' logging */
180194
bool stat_offsets_loaded;

drivers/net/ethernet/intel/ice/ice_adminq_cmd.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,24 @@ struct ice_aqc_manage_mac_read_resp {
135135
u8 mac_addr[ETH_ALEN];
136136
};
137137

138+
/* Manage MAC address, write command - direct (0x0108) */
139+
struct ice_aqc_manage_mac_write {
140+
u8 port_num;
141+
u8 flags;
142+
#define ICE_AQC_MAN_MAC_WR_MC_MAG_EN BIT(0)
143+
#define ICE_AQC_MAN_MAC_WR_WOL_LAA_PFR_KEEP BIT(1)
144+
#define ICE_AQC_MAN_MAC_WR_S 6
145+
#define ICE_AQC_MAN_MAC_WR_M (3 << ICE_AQC_MAN_MAC_WR_S)
146+
#define ICE_AQC_MAN_MAC_UPDATE_LAA 0
147+
#define ICE_AQC_MAN_MAC_UPDATE_LAA_WOL (BIT(0) << ICE_AQC_MAN_MAC_WR_S)
148+
/* High 16 bits of MAC address in big endian order */
149+
__be16 sah;
150+
/* Low 32 bits of MAC address in big endian order */
151+
__be32 sal;
152+
__le32 addr_high;
153+
__le32 addr_low;
154+
};
155+
138156
/* Clear PXE Command and response (direct 0x0110) */
139157
struct ice_aqc_clear_pxe {
140158
u8 rx_cnt;
@@ -1214,6 +1232,7 @@ struct ice_aq_desc {
12141232
struct ice_aqc_q_shutdown q_shutdown;
12151233
struct ice_aqc_req_res res_owner;
12161234
struct ice_aqc_manage_mac_read mac_read;
1235+
struct ice_aqc_manage_mac_write mac_write;
12171236
struct ice_aqc_clear_pxe clear_pxe;
12181237
struct ice_aqc_list_caps get_cap;
12191238
struct ice_aqc_get_phy_caps get_phy;
@@ -1258,6 +1277,7 @@ enum ice_aq_err {
12581277
ICE_AQ_RC_ENOMEM = 9, /* Out of memory */
12591278
ICE_AQ_RC_EBUSY = 12, /* Device or resource busy */
12601279
ICE_AQ_RC_EEXIST = 13, /* object already exists */
1280+
ICE_AQ_RC_ENOSPC = 16, /* No space left or allocation failure */
12611281
};
12621282

12631283
/* Admin Queue command opcodes */
@@ -1276,6 +1296,7 @@ enum ice_adminq_opc {
12761296

12771297
/* manage MAC address */
12781298
ice_aqc_opc_manage_mac_read = 0x0107,
1299+
ice_aqc_opc_manage_mac_write = 0x0108,
12791300

12801301
/* PXE */
12811302
ice_aqc_opc_clear_pxe_mode = 0x0110,

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,34 @@ enum ice_status ice_get_caps(struct ice_hw *hw)
12321232
return status;
12331233
}
12341234

1235+
/**
1236+
* ice_aq_manage_mac_write - manage MAC address write command
1237+
* @hw: pointer to the hw struct
1238+
* @mac_addr: MAC address to be written as LAA/LAA+WoL/Port address
1239+
* @flags: flags to control write behavior
1240+
* @cd: pointer to command details structure or NULL
1241+
*
1242+
* This function is used to write MAC address to the NVM (0x0108).
1243+
*/
1244+
enum ice_status
1245+
ice_aq_manage_mac_write(struct ice_hw *hw, u8 *mac_addr, u8 flags,
1246+
struct ice_sq_cd *cd)
1247+
{
1248+
struct ice_aqc_manage_mac_write *cmd;
1249+
struct ice_aq_desc desc;
1250+
1251+
cmd = &desc.params.mac_write;
1252+
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_manage_mac_write);
1253+
1254+
cmd->flags = flags;
1255+
1256+
/* Prep values for flags, sah, sal */
1257+
cmd->sah = htons(*((u16 *)mac_addr));
1258+
cmd->sal = htonl(*((u32 *)(mac_addr + 2)));
1259+
1260+
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
1261+
}
1262+
12351263
/**
12361264
* ice_aq_clear_pxe_mode
12371265
* @hw: pointer to the hw struct

drivers/net/ethernet/intel/ice/ice_common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ enum ice_status
5858
ice_aq_send_cmd(struct ice_hw *hw, struct ice_aq_desc *desc,
5959
void *buf, u16 buf_size, struct ice_sq_cd *cd);
6060
enum ice_status ice_aq_get_fw_ver(struct ice_hw *hw, struct ice_sq_cd *cd);
61+
enum ice_status
62+
ice_aq_manage_mac_write(struct ice_hw *hw, u8 *mac_addr, u8 flags,
63+
struct ice_sq_cd *cd);
6164
enum ice_status ice_clear_pf_cfg(struct ice_hw *hw);
6265
enum ice_status
6366
ice_set_fc(struct ice_port_info *pi, u8 *aq_failures, bool atomic_restart);

drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,18 @@ enum ice_tx_desc_len_fields {
353353
ICE_TX_DESC_LEN_L4_LEN_S = 14 /* 4 BITS */
354354
};
355355

356+
#define ICE_TXD_QW1_MACLEN_M (0x7FUL << ICE_TX_DESC_LEN_MACLEN_S)
357+
#define ICE_TXD_QW1_IPLEN_M (0x7FUL << ICE_TX_DESC_LEN_IPLEN_S)
358+
#define ICE_TXD_QW1_L4LEN_M (0xFUL << ICE_TX_DESC_LEN_L4_LEN_S)
359+
360+
/* Tx descriptor field limits in bytes */
361+
#define ICE_TXD_MACLEN_MAX ((ICE_TXD_QW1_MACLEN_M >> \
362+
ICE_TX_DESC_LEN_MACLEN_S) * ICE_BYTES_PER_WORD)
363+
#define ICE_TXD_IPLEN_MAX ((ICE_TXD_QW1_IPLEN_M >> \
364+
ICE_TX_DESC_LEN_IPLEN_S) * ICE_BYTES_PER_DWORD)
365+
#define ICE_TXD_L4LEN_MAX ((ICE_TXD_QW1_L4LEN_M >> \
366+
ICE_TX_DESC_LEN_L4_LEN_S) * ICE_BYTES_PER_DWORD)
367+
356368
#define ICE_TXD_QW1_TX_BUF_SZ_S 34
357369
#define ICE_TXD_QW1_L2TAG1_S 48
358370

0 commit comments

Comments
 (0)