Skip to content

Commit

Permalink
tgupdate: merge t/selftests-bpf-Add-bpf_bkup-scheduler into t/selftes…
Browse files Browse the repository at this point in the history
…ts-bpf-Add-bpf_bkup-test base
  • Loading branch information
jenkins-tessares committed Nov 23, 2022
2 parents 942c077 + bad5e3b commit 68632c5
Show file tree
Hide file tree
Showing 64 changed files with 3,445 additions and 3,175 deletions.
14 changes: 14 additions & 0 deletions drivers/i2c/i2c-core-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2236,6 +2236,20 @@ int i2c_get_device_id(const struct i2c_client *client,
}
EXPORT_SYMBOL_GPL(i2c_get_device_id);

/**
* i2c_client_get_device_id - get the driver match table entry of a device
* @client: the device to query. The device must be bound to a driver
*
* Returns a pointer to the matching entry if found, NULL otherwise.
*/
const struct i2c_device_id *i2c_client_get_device_id(const struct i2c_client *client)
{
const struct i2c_driver *drv = to_i2c_driver(client->dev.driver);

return i2c_match_id(drv->id_table, client);
}
EXPORT_SYMBOL_GPL(i2c_client_get_device_id);

/* ----------------------------------------------------
* the i2c address scanning function
* Will not work for 10-bit addresses!
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/dsa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ config NET_DSA_BCM_SF2

config NET_DSA_LOOP
tristate "DSA mock-up Ethernet switch chip support"
select NET_DSA_TAG_NONE
select FIXED_PHY
help
This enables support for a fake mock-up switch chip which
Expand Down Expand Up @@ -99,6 +100,7 @@ config NET_DSA_SMSC_LAN9303_MDIO

config NET_DSA_VITESSE_VSC73XX
tristate
select NET_DSA_TAG_NONE
select FIXED_PHY
select VITESSE_PHY
select GPIOLIB
Expand Down
1 change: 1 addition & 0 deletions drivers/net/dsa/b53/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
menuconfig B53
tristate "Broadcom BCM53xx managed switch support"
depends on NET_DSA
select NET_DSA_TAG_NONE
select NET_DSA_TAG_BRCM
select NET_DSA_TAG_BRCM_LEGACY
select NET_DSA_TAG_BRCM_PREPEND
Expand Down
1 change: 1 addition & 0 deletions drivers/net/dsa/microchip/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ menuconfig NET_DSA_MICROCHIP_KSZ_COMMON
tristate "Microchip KSZ8795/KSZ9477/LAN937x series switch support"
depends on NET_DSA
select NET_DSA_TAG_KSZ
select NET_DSA_TAG_NONE
help
This driver adds support for Microchip KSZ9477 series switch and
KSZ8795/KSZ88x3 switch chips.
Expand Down
1 change: 0 additions & 1 deletion drivers/net/dsa/ocelot/felix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,6 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)
return -ENOMEM;

ocelot->map = felix->info->map;
ocelot->stats_layout = felix->info->stats_layout;
ocelot->num_mact_rows = felix->info->num_mact_rows;
ocelot->vcap = felix->info->vcap;
ocelot->vcap_pol.base = felix->info->vcap_pol_base;
Expand Down
1 change: 0 additions & 1 deletion drivers/net/dsa/ocelot/felix.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ struct felix_info {
const struct ocelot_ops *ops;
const u32 *port_modes;
int num_mact_rows;
const struct ocelot_stat_layout *stats_layout;
int num_ports;
int num_tx_queues;
struct vcap_props *vcap;
Expand Down
5 changes: 0 additions & 5 deletions drivers/net/dsa/ocelot/felix_vsc9959.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,6 @@ static const struct reg_field vsc9959_regfields[REGFIELD_MAX] = {
[SYS_PAUSE_CFG_PAUSE_ENA] = REG_FIELD_ID(SYS_PAUSE_CFG, 0, 1, 7, 4),
};

static const struct ocelot_stat_layout vsc9959_stats_layout[OCELOT_NUM_STATS] = {
OCELOT_COMMON_STATS,
};

static const struct vcap_field vsc9959_vcap_es0_keys[] = {
[VCAP_ES0_EGR_PORT] = { 0, 3},
[VCAP_ES0_IGR_PORT] = { 3, 3},
Expand Down Expand Up @@ -2546,7 +2542,6 @@ static const struct felix_info felix_info_vsc9959 = {
.regfields = vsc9959_regfields,
.map = vsc9959_regmap,
.ops = &vsc9959_ops,
.stats_layout = vsc9959_stats_layout,
.vcap = vsc9959_vcap_props,
.vcap_pol_base = VSC9959_VCAP_POLICER_BASE,
.vcap_pol_max = VSC9959_VCAP_POLICER_MAX,
Expand Down
5 changes: 0 additions & 5 deletions drivers/net/dsa/ocelot/seville_vsc9953.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,6 @@ static const struct reg_field vsc9953_regfields[REGFIELD_MAX] = {
[SYS_PAUSE_CFG_PAUSE_ENA] = REG_FIELD_ID(SYS_PAUSE_CFG, 0, 1, 11, 4),
};

static const struct ocelot_stat_layout vsc9953_stats_layout[OCELOT_NUM_STATS] = {
OCELOT_COMMON_STATS,
};

static const struct vcap_field vsc9953_vcap_es0_keys[] = {
[VCAP_ES0_EGR_PORT] = { 0, 4},
[VCAP_ES0_IGR_PORT] = { 4, 4},
Expand Down Expand Up @@ -970,7 +966,6 @@ static const struct felix_info seville_info_vsc9953 = {
.regfields = vsc9953_regfields,
.map = vsc9953_regmap,
.ops = &vsc9953_ops,
.stats_layout = vsc9953_stats_layout,
.vcap = vsc9953_vcap_props,
.vcap_pol_base = VSC9953_VCAP_POLICER_BASE,
.vcap_pol_max = VSC9953_VCAP_POLICER_MAX,
Expand Down
14 changes: 14 additions & 0 deletions drivers/net/ethernet/marvell/octeontx2/af/mbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ M(NPC_MCAM_GET_STATS, 0x6012, npc_mcam_entry_stats, \
M(NPC_GET_SECRET_KEY, 0x6013, npc_get_secret_key, \
npc_get_secret_key_req, \
npc_get_secret_key_rsp) \
M(NPC_GET_FIELD_STATUS, 0x6014, npc_get_field_status, \
npc_get_field_status_req, \
npc_get_field_status_rsp) \
/* NIX mbox IDs (range 0x8000 - 0xFFFF) */ \
M(NIX_LF_ALLOC, 0x8000, nix_lf_alloc, \
nix_lf_alloc_req, nix_lf_alloc_rsp) \
Expand Down Expand Up @@ -1541,6 +1544,17 @@ struct ptp_rsp {
u64 clk;
};

struct npc_get_field_status_req {
struct mbox_msghdr hdr;
u8 intf;
u8 field;
};

struct npc_get_field_status_rsp {
struct mbox_msghdr hdr;
u8 enable;
};

struct set_vf_perm {
struct mbox_msghdr hdr;
u16 vf;
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/marvell/octeontx2/af/rvu.h
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ int npc_install_mcam_drop_rule(struct rvu *rvu, int mcam_idx, u16 *counter_idx,
u64 chan_val, u64 chan_mask, u64 exact_val, u64 exact_mask,
u64 bcast_mcast_val, u64 bcast_mcast_mask);
void npc_mcam_rsrcs_reserve(struct rvu *rvu, int blkaddr, int entry_idx);
bool npc_is_feature_supported(struct rvu *rvu, u64 features, u8 intf);

/* CPT APIs */
int rvu_cpt_register_interrupts(struct rvu *rvu);
Expand Down
22 changes: 22 additions & 0 deletions drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,12 @@ void rvu_npc_install_ucast_entry(struct rvu *rvu, u16 pcifunc,
if (blkaddr < 0)
return;

/* Ucast rule should not be installed if DMAC
* extraction is not supported by the profile.
*/
if (!npc_is_feature_supported(rvu, BIT_ULL(NPC_DMAC), pfvf->nix_rx_intf))
return;

index = npc_get_nixlf_mcam_index(mcam, pcifunc,
nixlf, NIXLF_UCAST_ENTRY);

Expand Down Expand Up @@ -778,6 +784,14 @@ void rvu_npc_install_bcast_match_entry(struct rvu *rvu, u16 pcifunc,
/* Get 'pcifunc' of PF device */
pcifunc = pcifunc & ~RVU_PFVF_FUNC_MASK;
pfvf = rvu_get_pfvf(rvu, pcifunc);

/* Bcast rule should not be installed if both DMAC
* and LXMB extraction is not supported by the profile.
*/
if (!npc_is_feature_supported(rvu, BIT_ULL(NPC_DMAC), pfvf->nix_rx_intf) &&
!npc_is_feature_supported(rvu, BIT_ULL(NPC_LXMB), pfvf->nix_rx_intf))
return;

index = npc_get_nixlf_mcam_index(mcam, pcifunc,
nixlf, NIXLF_BCAST_ENTRY);

Expand Down Expand Up @@ -848,6 +862,14 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
vf_func = pcifunc & RVU_PFVF_FUNC_MASK;
pcifunc = pcifunc & ~RVU_PFVF_FUNC_MASK;
pfvf = rvu_get_pfvf(rvu, pcifunc);

/* Mcast rule should not be installed if both DMAC
* and LXMB extraction is not supported by the profile.
*/
if (!npc_is_feature_supported(rvu, BIT_ULL(NPC_DMAC), pfvf->nix_rx_intf) &&
!npc_is_feature_supported(rvu, BIT_ULL(NPC_LXMB), pfvf->nix_rx_intf))
return;

index = npc_get_nixlf_mcam_index(mcam, pcifunc,
nixlf, NIXLF_ALLMULTI_ENTRY);

Expand Down
76 changes: 62 additions & 14 deletions drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ static const char * const npc_flow_names[] = {
[NPC_UNKNOWN] = "unknown",
};

bool npc_is_feature_supported(struct rvu *rvu, u64 features, u8 intf)
{
struct npc_mcam *mcam = &rvu->hw->mcam;
u64 mcam_features;
u64 unsupported;

mcam_features = is_npc_intf_tx(intf) ? mcam->tx_features : mcam->rx_features;
unsupported = (mcam_features ^ features) & ~mcam_features;

/* Return false if at least one of the input flows is not extracted */
return !unsupported;
}

const char *npc_get_field_name(u8 hdr)
{
if (hdr >= ARRAY_SIZE(npc_flow_names))
Expand Down Expand Up @@ -436,8 +449,6 @@ static void npc_scan_ldata(struct rvu *rvu, int blkaddr, u8 lid,
nr_bytes = FIELD_GET(NPC_BYTESM, cfg) + 1;
hdr = FIELD_GET(NPC_HDR_OFFSET, cfg);
key = FIELD_GET(NPC_KEY_OFFSET, cfg);
start_kwi = key / 8;
offset = (key * 8) % 64;

/* For Tx, Layer A has NIX_INST_HDR_S(64 bytes) preceding
* ethernet header.
Expand All @@ -452,13 +463,18 @@ static void npc_scan_ldata(struct rvu *rvu, int blkaddr, u8 lid,

#define NPC_SCAN_HDR(name, hlid, hlt, hstart, hlen) \
do { \
start_kwi = key / 8; \
offset = (key * 8) % 64; \
if (lid == (hlid) && lt == (hlt)) { \
if ((hstart) >= hdr && \
((hstart) + (hlen)) <= (hdr + nr_bytes)) { \
bit_offset = (hdr + nr_bytes - (hstart) - (hlen)) * 8; \
npc_set_layer_mdata(mcam, (name), cfg, lid, lt, intf); \
offset += bit_offset; \
start_kwi += offset / 64; \
offset %= 64; \
npc_set_kw_masks(mcam, (name), (hlen) * 8, \
start_kwi, offset + bit_offset, intf);\
start_kwi, offset, intf); \
} \
} \
} while (0)
Expand Down Expand Up @@ -650,9 +666,9 @@ static int npc_check_unsupported_flows(struct rvu *rvu, u64 features, u8 intf)

unsupported = (*mcam_features ^ features) & ~(*mcam_features);
if (unsupported) {
dev_info(rvu->dev, "Unsupported flow(s):\n");
dev_warn(rvu->dev, "Unsupported flow(s):\n");
for_each_set_bit(bit, (unsigned long *)&unsupported, 64)
dev_info(rvu->dev, "%s ", npc_get_field_name(bit));
dev_warn(rvu->dev, "%s ", npc_get_field_name(bit));
return -EOPNOTSUPP;
}

Expand Down Expand Up @@ -1007,8 +1023,20 @@ static void npc_update_rx_entry(struct rvu *rvu, struct rvu_pfvf *pfvf,
action.match_id = req->match_id;
action.flow_key_alg = req->flow_key_alg;

if (req->op == NIX_RX_ACTION_DEFAULT && pfvf->def_ucast_rule)
action = pfvf->def_ucast_rule->rx_action;
if (req->op == NIX_RX_ACTION_DEFAULT) {
if (pfvf->def_ucast_rule) {
action = pfvf->def_ucast_rule->rx_action;
} else {
/* For profiles which do not extract DMAC, the default
* unicast entry is unused. Hence modify action for the
* requests which use same action as default unicast
* entry
*/
*(u64 *)&action = 0;
action.pf_func = target;
action.op = NIX_RX_ACTIONOP_UCAST;
}
}

entry->action = *(u64 *)&action;

Expand Down Expand Up @@ -1239,18 +1267,19 @@ int rvu_mbox_handler_npc_install_flow(struct rvu *rvu,
if (npc_check_field(rvu, blkaddr, NPC_DMAC, req->intf))
goto process_flow;

if (is_pffunc_af(req->hdr.pcifunc)) {
if (is_pffunc_af(req->hdr.pcifunc) &&
req->features & BIT_ULL(NPC_DMAC)) {
if (is_unicast_ether_addr(req->packet.dmac)) {
dev_err(rvu->dev,
"%s: mkex profile does not support ucast flow\n",
__func__);
dev_warn(rvu->dev,
"%s: mkex profile does not support ucast flow\n",
__func__);
return NPC_FLOW_NOT_SUPPORTED;
}

if (!npc_is_field_present(rvu, NPC_LXMB, req->intf)) {
dev_err(rvu->dev,
"%s: mkex profile does not support bcast/mcast flow",
__func__);
dev_warn(rvu->dev,
"%s: mkex profile does not support bcast/mcast flow",
__func__);
return NPC_FLOW_NOT_SUPPORTED;
}

Expand Down Expand Up @@ -1603,3 +1632,22 @@ int npc_install_mcam_drop_rule(struct rvu *rvu, int mcam_idx, u16 *counter_idx,

return 0;
}

int rvu_mbox_handler_npc_get_field_status(struct rvu *rvu,
struct npc_get_field_status_req *req,
struct npc_get_field_status_rsp *rsp)
{
int blkaddr;

blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
if (blkaddr < 0)
return NPC_MCAM_INVALID_REQ;

if (!is_npc_interface_valid(rvu, req->intf))
return NPC_FLOW_INTF_INVALID;

if (npc_check_field(rvu, blkaddr, req->field, req->intf))
rsp->enable = 1;

return 0;
}
27 changes: 25 additions & 2 deletions drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ EXPORT_SYMBOL(otx2_alloc_mcam_entries);
static int otx2_mcam_entry_init(struct otx2_nic *pfvf)
{
struct otx2_flow_config *flow_cfg = pfvf->flow_cfg;
struct npc_get_field_status_req *freq;
struct npc_get_field_status_rsp *frsp;
struct npc_mcam_alloc_entry_req *req;
struct npc_mcam_alloc_entry_rsp *rsp;
int vf_vlan_max_flows;
Expand Down Expand Up @@ -214,8 +216,29 @@ static int otx2_mcam_entry_init(struct otx2_nic *pfvf)
flow_cfg->rx_vlan_offset = flow_cfg->unicast_offset +
OTX2_MAX_UNICAST_FLOWS;
pfvf->flags |= OTX2_FLAG_UCAST_FLTR_SUPPORT;
pfvf->flags |= OTX2_FLAG_RX_VLAN_SUPPORT;
pfvf->flags |= OTX2_FLAG_VF_VLAN_SUPPORT;

/* Check if NPC_DMAC field is supported
* by the mkex profile before setting VLAN support flag.
*/
freq = otx2_mbox_alloc_msg_npc_get_field_status(&pfvf->mbox);
if (!freq) {
mutex_unlock(&pfvf->mbox.lock);
return -ENOMEM;
}

freq->field = NPC_DMAC;
if (otx2_sync_mbox_msg(&pfvf->mbox)) {
mutex_unlock(&pfvf->mbox.lock);
return -EINVAL;
}

frsp = (struct npc_get_field_status_rsp *)otx2_mbox_get_rsp
(&pfvf->mbox.mbox, 0, &freq->hdr);

if (frsp->enable) {
pfvf->flags |= OTX2_FLAG_RX_VLAN_SUPPORT;
pfvf->flags |= OTX2_FLAG_VF_VLAN_SUPPORT;
}

pfvf->flags |= OTX2_FLAG_MCAM_ENTRIES_ALLOC;
mutex_unlock(&pfvf->mbox.lock);
Expand Down
Loading

0 comments on commit 68632c5

Please sign in to comment.