Skip to content

Commit 3b8f56e

Browse files
committed
Merge branch '100GbE-Intel-Wired-LAN-Driver-Updates-2020-10-07'
Tony Nguyen says: ==================== 100GbE Intel Wired LAN Driver Updates 2020-10-07 This series contains updates to ice driver only. Andy Shevchenko changes usage to %*phD format to print small buffer as hex string. Bruce removes repeated words reported by checkpatch. Ani changes ice_info_get_dsn() to return void as it always returns success. Jake adds devlink reporting of fw.app.bundle_id. Moves devlink_port structure to ice_vsi to resolve issues with cleanup. Adds additional debug info for firmware updates. Bixuan Cui resolves -Wpointer-to-int-cast warnings. Dan adds additional packet type masks and checks to prevent overwriting existing Flow Director rules. ==================== Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 5d3b8ec + 051d2b5 commit 3b8f56e

File tree

11 files changed

+162
-58
lines changed

11 files changed

+162
-58
lines changed

Documentation/networking/devlink/ice.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ The ``ice`` driver reports the following versions
6969
- The version of the DDP package that is active in the device. Note
7070
that both the name (as reported by ``fw.app.name``) and version are
7171
required to uniquely identify the package.
72+
* - ``fw.app.bundle_id``
73+
- 0xc0000001
74+
- Unique identifier for the DDP package loaded in the device. Also
75+
referred to as the DDP Track ID. Can be used to uniquely identify
76+
the specific DDP package.
7277
* - ``fw.netlist``
7378
- running
7479
- 1.1.2000-6.7.0

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,10 @@ struct ice_vsi {
284284
spinlock_t arfs_lock; /* protects aRFS hash table and filter state */
285285
atomic_t *arfs_last_fltr_id;
286286

287+
/* devlink port data */
288+
struct devlink_port devlink_port;
289+
bool devlink_port_registered;
290+
287291
u16 max_frame;
288292
u16 rx_buf_len;
289293

@@ -375,9 +379,6 @@ enum ice_pf_flags {
375379
struct ice_pf {
376380
struct pci_dev *pdev;
377381

378-
/* devlink port data */
379-
struct devlink_port devlink_port;
380-
381382
struct devlink_region *nvm_region;
382383
struct devlink_region *devcaps_region;
383384

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

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@
66
#include "ice_devlink.h"
77
#include "ice_fw_update.h"
88

9-
static int ice_info_get_dsn(struct ice_pf *pf, char *buf, size_t len)
9+
static void ice_info_get_dsn(struct ice_pf *pf, char *buf, size_t len)
1010
{
1111
u8 dsn[8];
1212

1313
/* Copy the DSN into an array in Big Endian format */
1414
put_unaligned_be64(pci_get_dsn(pf->pdev), dsn);
1515

16-
snprintf(buf, len, "%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x",
17-
dsn[0], dsn[1], dsn[2], dsn[3],
18-
dsn[4], dsn[5], dsn[6], dsn[7]);
19-
20-
return 0;
16+
snprintf(buf, len, "%8phD", dsn);
2117
}
2218

2319
static int ice_info_pba(struct ice_pf *pf, char *buf, size_t len)
@@ -106,6 +102,13 @@ static int ice_info_ddp_pkg_version(struct ice_pf *pf, char *buf, size_t len)
106102
return 0;
107103
}
108104

105+
static int ice_info_ddp_pkg_bundle_id(struct ice_pf *pf, char *buf, size_t len)
106+
{
107+
snprintf(buf, len, "0x%08x", pf->hw.active_track_id);
108+
109+
return 0;
110+
}
111+
109112
static int ice_info_netlist_ver(struct ice_pf *pf, char *buf, size_t len)
110113
{
111114
struct ice_netlist_ver_info *netlist = &pf->hw.netlist_ver;
@@ -150,6 +153,7 @@ static const struct ice_devlink_version {
150153
running(DEVLINK_INFO_VERSION_GENERIC_FW_BUNDLE_ID, ice_info_eetrack),
151154
running("fw.app.name", ice_info_ddp_pkg_name),
152155
running(DEVLINK_INFO_VERSION_GENERIC_FW_APP, ice_info_ddp_pkg_version),
156+
running("fw.app.bundle_id", ice_info_ddp_pkg_bundle_id),
153157
running("fw.netlist", ice_info_netlist_ver),
154158
running("fw.netlist.build", ice_info_netlist_build),
155159
};
@@ -180,11 +184,7 @@ static int ice_devlink_info_get(struct devlink *devlink,
180184
return err;
181185
}
182186

183-
err = ice_info_get_dsn(pf, buf, sizeof(buf));
184-
if (err) {
185-
NL_SET_ERR_MSG_MOD(extack, "Unable to obtain serial number");
186-
return err;
187-
}
187+
ice_info_get_dsn(pf, buf, sizeof(buf));
188188

189189
err = devlink_info_serial_number_put(req, buf);
190190
if (err) {
@@ -283,6 +283,8 @@ ice_devlink_flash_update(struct devlink *devlink,
283283
return err;
284284
}
285285

286+
dev_dbg(dev, "Beginning flash update with file '%s'\n", params->file_name);
287+
286288
devlink_flash_update_begin_notify(devlink);
287289
devlink_flash_update_status_notify(devlink, "Preparing to flash", NULL, 0, 0);
288290
err = ice_flash_pldm_image(pf, fw, preservation, extack);
@@ -364,50 +366,60 @@ void ice_devlink_unregister(struct ice_pf *pf)
364366
}
365367

366368
/**
367-
* ice_devlink_create_port - Create a devlink port for this PF
368-
* @pf: the PF to create a port for
369+
* ice_devlink_create_port - Create a devlink port for this VSI
370+
* @vsi: the VSI to create a port for
369371
*
370-
* Create and register a devlink_port for this PF. Note that although each
371-
* physical function is connected to a separate devlink instance, the port
372-
* will still be numbered according to the physical function ID.
372+
* Create and register a devlink_port for this VSI.
373373
*
374374
* Return: zero on success or an error code on failure.
375375
*/
376-
int ice_devlink_create_port(struct ice_pf *pf)
376+
int ice_devlink_create_port(struct ice_vsi *vsi)
377377
{
378-
struct devlink *devlink = priv_to_devlink(pf);
379-
struct ice_vsi *vsi = ice_get_main_vsi(pf);
380-
struct device *dev = ice_pf_to_dev(pf);
381378
struct devlink_port_attrs attrs = {};
379+
struct ice_port_info *pi;
380+
struct devlink *devlink;
381+
struct device *dev;
382+
struct ice_pf *pf;
382383
int err;
383384

384-
if (!vsi) {
385-
dev_err(dev, "%s: unable to find main VSI\n", __func__);
386-
return -EIO;
387-
}
385+
/* Currently we only create devlink_port instances for PF VSIs */
386+
if (vsi->type != ICE_VSI_PF)
387+
return -EINVAL;
388+
389+
pf = vsi->back;
390+
devlink = priv_to_devlink(pf);
391+
dev = ice_pf_to_dev(pf);
392+
pi = pf->hw.port_info;
388393

389394
attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
390-
attrs.phys.port_number = pf->hw.pf_id;
391-
devlink_port_attrs_set(&pf->devlink_port, &attrs);
392-
err = devlink_port_register(devlink, &pf->devlink_port, pf->hw.pf_id);
395+
attrs.phys.port_number = pi->lport;
396+
devlink_port_attrs_set(&vsi->devlink_port, &attrs);
397+
err = devlink_port_register(devlink, &vsi->devlink_port, vsi->idx);
393398
if (err) {
394399
dev_err(dev, "devlink_port_register failed: %d\n", err);
395400
return err;
396401
}
397402

403+
vsi->devlink_port_registered = true;
404+
398405
return 0;
399406
}
400407

401408
/**
402-
* ice_devlink_destroy_port - Destroy the devlink_port for this PF
403-
* @pf: the PF to cleanup
409+
* ice_devlink_destroy_port - Destroy the devlink_port for this VSI
410+
* @vsi: the VSI to cleanup
404411
*
405-
* Unregisters the devlink_port structure associated with this PF.
412+
* Unregisters the devlink_port structure associated with this VSI.
406413
*/
407-
void ice_devlink_destroy_port(struct ice_pf *pf)
414+
void ice_devlink_destroy_port(struct ice_vsi *vsi)
408415
{
409-
devlink_port_type_clear(&pf->devlink_port);
410-
devlink_port_unregister(&pf->devlink_port);
416+
if (!vsi->devlink_port_registered)
417+
return;
418+
419+
devlink_port_type_clear(&vsi->devlink_port);
420+
devlink_port_unregister(&vsi->devlink_port);
421+
422+
vsi->devlink_port_registered = false;
411423
}
412424

413425
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ struct ice_pf *ice_allocate_pf(struct device *dev);
88

99
int ice_devlink_register(struct ice_pf *pf);
1010
void ice_devlink_unregister(struct ice_pf *pf);
11-
int ice_devlink_create_port(struct ice_pf *pf);
12-
void ice_devlink_destroy_port(struct ice_pf *pf);
11+
int ice_devlink_create_port(struct ice_vsi *vsi);
12+
void ice_devlink_destroy_port(struct ice_vsi *vsi);
1313

1414
void ice_devlink_init_regions(struct ice_pf *pf);
1515
void ice_devlink_destroy_regions(struct ice_pf *pf);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4876,7 +4876,7 @@ ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl)
48764876

48774877
if (last_profile) {
48784878
/* If there are no profiles left for this VSIG,
4879-
* then simply remove the the VSIG.
4879+
* then simply remove the VSIG.
48804880
*/
48814881
status = ice_rem_vsig(hw, blk, vsig, &chg);
48824882
if (status)

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

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,54 @@ static const u32 ice_ptypes_ipv6_il[] = {
9999
0x00000000, 0x00000000, 0x00000000, 0x00000000,
100100
};
101101

102+
/* Packet types for packets with an Outer/First/Single IPv4 header - no L4 */
103+
static const u32 ice_ipv4_ofos_no_l4[] = {
104+
0x10C00000, 0x04000800, 0x00000000, 0x00000000,
105+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
106+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
107+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
108+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
109+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
110+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
111+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
112+
};
113+
114+
/* Packet types for packets with an Innermost/Last IPv4 header - no L4 */
115+
static const u32 ice_ipv4_il_no_l4[] = {
116+
0x60000000, 0x18043008, 0x80000002, 0x6010c021,
117+
0x00000008, 0x00000000, 0x00000000, 0x00000000,
118+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
119+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
120+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
121+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
122+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
123+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
124+
};
125+
126+
/* Packet types for packets with an Outer/First/Single IPv6 header - no L4 */
127+
static const u32 ice_ipv6_ofos_no_l4[] = {
128+
0x00000000, 0x00000000, 0x43000000, 0x10002000,
129+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
130+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
131+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
132+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
133+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
134+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
135+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
136+
};
137+
138+
/* Packet types for packets with an Innermost/Last IPv6 header - no L4 */
139+
static const u32 ice_ipv6_il_no_l4[] = {
140+
0x00000000, 0x02180430, 0x0000010c, 0x086010c0,
141+
0x00000430, 0x00000000, 0x00000000, 0x00000000,
142+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
143+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
144+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
145+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
146+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
147+
0x00000000, 0x00000000, 0x00000000, 0x00000000,
148+
};
149+
102150
/* UDP Packet types for non-tunneled packets or tunneled
103151
* packets with inner UDP.
104152
*/
@@ -250,11 +298,23 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
250298

251299
hdrs = prof->segs[i].hdrs;
252300

253-
if (hdrs & ICE_FLOW_SEG_HDR_IPV4) {
301+
if ((hdrs & ICE_FLOW_SEG_HDR_IPV4) &&
302+
!(hdrs & ICE_FLOW_SEG_HDRS_L4_MASK)) {
303+
src = !i ? (const unsigned long *)ice_ipv4_ofos_no_l4 :
304+
(const unsigned long *)ice_ipv4_il_no_l4;
305+
bitmap_and(params->ptypes, params->ptypes, src,
306+
ICE_FLOW_PTYPE_MAX);
307+
} else if (hdrs & ICE_FLOW_SEG_HDR_IPV4) {
254308
src = !i ? (const unsigned long *)ice_ptypes_ipv4_ofos :
255309
(const unsigned long *)ice_ptypes_ipv4_il;
256310
bitmap_and(params->ptypes, params->ptypes, src,
257311
ICE_FLOW_PTYPE_MAX);
312+
} else if ((hdrs & ICE_FLOW_SEG_HDR_IPV6) &&
313+
!(hdrs & ICE_FLOW_SEG_HDRS_L4_MASK)) {
314+
src = !i ? (const unsigned long *)ice_ipv6_ofos_no_l4 :
315+
(const unsigned long *)ice_ipv6_il_no_l4;
316+
bitmap_and(params->ptypes, params->ptypes, src,
317+
ICE_FLOW_PTYPE_MAX);
258318
} else if (hdrs & ICE_FLOW_SEG_HDR_IPV6) {
259319
src = !i ? (const unsigned long *)ice_ptypes_ipv6_ofos :
260320
(const unsigned long *)ice_ptypes_ipv6_il;
@@ -385,7 +445,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
385445
* ice_flow_xtract_raws - Create extract sequence entries for raw bytes
386446
* @hw: pointer to the HW struct
387447
* @params: information about the flow to be processed
388-
* @seg: index of packet segment whose raw fields are to be be extracted
448+
* @seg: index of packet segment whose raw fields are to be extracted
389449
*/
390450
static enum ice_status
391451
ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
@@ -999,7 +1059,7 @@ enum ice_status ice_flow_rem_entry(struct ice_hw *hw, enum ice_block blk,
9991059
*
10001060
* This helper function stores information of a field being matched, including
10011061
* the type of the field and the locations of the value to match, the mask, and
1002-
* and the upper-bound value in the start of the input buffer for a flow entry.
1062+
* the upper-bound value in the start of the input buffer for a flow entry.
10031063
* This function should only be used for fixed-size data structures.
10041064
*
10051065
* This function also opportunistically determines the protocol headers to be

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ struct ice_flow_entry {
194194
u16 entry_sz;
195195
};
196196

197-
#define ICE_FLOW_ENTRY_HNDL(e) ((u64)e)
198-
#define ICE_FLOW_ENTRY_PTR(h) ((struct ice_flow_entry *)(h))
197+
#define ICE_FLOW_ENTRY_HNDL(e) ((u64)(uintptr_t)e)
198+
#define ICE_FLOW_ENTRY_PTR(h) ((struct ice_flow_entry *)(uintptr_t)(h))
199199

200200
struct ice_flow_prof {
201201
struct list_head l_entry;

0 commit comments

Comments
 (0)