Preparation for adding more data to it, which will increase its size.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: David S. Miller <davem@davemloft.net>
if (err)
return err;
- if (eth->soc->offload_version && mtk_ppe_start(ð->ppe) == 0)
+ if (eth->soc->offload_version && mtk_ppe_start(eth->ppe) == 0)
gdm_config = MTK_GDMA_TO_PPE;
mtk_gdm_config(eth, gdm_config);
mtk_dma_free(eth);
if (eth->soc->offload_version)
- mtk_ppe_stop(ð->ppe);
+ mtk_ppe_stop(eth->ppe);
return 0;
}
}
if (eth->soc->offload_version) {
- err = mtk_ppe_init(ð->ppe, eth->dev,
- eth->base + MTK_ETH_PPE_BASE, 2);
- if (err)
+ eth->ppe = mtk_ppe_init(eth->dev, eth->base + MTK_ETH_PPE_BASE, 2);
+ if (!eth->ppe) {
+ err = -ENOMEM;
goto err_free_dev;
+ }
err = mtk_eth_offload_init(eth);
if (err)
u32 rx_dma_l4_valid;
int ip_align;
- struct mtk_ppe ppe;
+ struct mtk_ppe *ppe;
struct rhashtable flow_table;
};
return hash;
}
-int mtk_ppe_init(struct mtk_ppe *ppe, struct device *dev, void __iomem *base,
+struct mtk_ppe *mtk_ppe_init(struct device *dev, void __iomem *base,
int version)
{
struct mtk_foe_entry *foe;
+ struct mtk_ppe *ppe;
+
+ ppe = devm_kzalloc(dev, sizeof(*ppe), GFP_KERNEL);
+ if (!ppe)
+ return NULL;
/* need to allocate a separate device, since it PPE DMA access is
* not coherent.
foe = dmam_alloc_coherent(ppe->dev, MTK_PPE_ENTRIES * sizeof(*foe),
&ppe->foe_phys, GFP_KERNEL);
if (!foe)
- return -ENOMEM;
+ return NULL;
ppe->foe_table = foe;
mtk_ppe_debugfs_init(ppe);
- return 0;
+ return ppe;
}
static void mtk_ppe_init_foe_table(struct mtk_ppe *ppe)
void *acct_table;
};
-int mtk_ppe_init(struct mtk_ppe *ppe, struct device *dev, void __iomem *base,
- int version);
+struct mtk_ppe *mtk_ppe_init(struct device *dev, void __iomem *base, int version);
int mtk_ppe_start(struct mtk_ppe *ppe);
int mtk_ppe_stop(struct mtk_ppe *ppe);
entry->cookie = f->cookie;
timestamp = mtk_eth_timestamp(eth);
- hash = mtk_foe_entry_commit(ð->ppe, &foe, timestamp);
+ hash = mtk_foe_entry_commit(eth->ppe, &foe, timestamp);
if (hash < 0) {
err = hash;
goto free;
return 0;
clear_flow:
- mtk_foe_entry_clear(ð->ppe, hash);
+ mtk_foe_entry_clear(eth->ppe, hash);
free:
kfree(entry);
if (wed_index >= 0)
if (!entry)
return -ENOENT;
- mtk_foe_entry_clear(ð->ppe, entry->hash);
+ mtk_foe_entry_clear(eth->ppe, entry->hash);
rhashtable_remove_fast(ð->flow_table, &entry->node,
mtk_flow_ht_params);
if (entry->wed_index >= 0)
if (!entry)
return -ENOENT;
- timestamp = mtk_foe_entry_timestamp(ð->ppe, entry->hash);
+ timestamp = mtk_foe_entry_timestamp(eth->ppe, entry->hash);
if (timestamp < 0)
return -ETIMEDOUT;
struct flow_block_cb *block_cb;
flow_setup_cb_t *cb;
- if (!eth->ppe.foe_table)
+ if (!eth->ppe || !eth->ppe->foe_table)
return -EOPNOTSUPP;
if (f->binder_type != FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS)
int mtk_eth_offload_init(struct mtk_eth *eth)
{
- if (!eth->ppe.foe_table)
+ if (!eth->ppe || !eth->ppe->foe_table)
return 0;
return rhashtable_init(ð->flow_table, &mtk_flow_ht_params);