struct enetc_si *si = priv->si;
int err;
- err = enetc_alloc_cbdr(priv->dev, &si->cbd_ring);
+ err = enetc_setup_cbdr(priv->dev, &si->hw, &si->cbd_ring);
if (err)
return err;
- enetc_setup_cbdr(&si->hw, &si->cbd_ring);
-
priv->cls_rules = kcalloc(si->num_fs_entries, sizeof(*priv->cls_rules),
GFP_KERNEL);
if (!priv->cls_rules) {
void enetc_set_ethtool_ops(struct net_device *ndev);
/* control buffer descriptor ring (CBDR) */
-int enetc_alloc_cbdr(struct device *dev, struct enetc_cbdr *cbdr);
+int enetc_setup_cbdr(struct device *dev, struct enetc_hw *hw,
+ struct enetc_cbdr *cbdr);
void enetc_free_cbdr(struct enetc_cbdr *cbdr);
-void enetc_setup_cbdr(struct enetc_hw *hw, struct enetc_cbdr *cbdr);
void enetc_clear_cbdr(struct enetc_hw *hw);
int enetc_set_mac_flt_entry(struct enetc_si *si, int index,
char *mac_addr, int si_map);
#include "enetc.h"
-int enetc_alloc_cbdr(struct device *dev, struct enetc_cbdr *cbdr)
+int enetc_setup_cbdr(struct device *dev, struct enetc_hw *hw,
+ struct enetc_cbdr *cbdr)
{
int size = cbdr->bd_count * sizeof(struct enetc_cbd);
cbdr->next_to_use = 0;
cbdr->dma_dev = dev;
- return 0;
-}
-
-void enetc_free_cbdr(struct enetc_cbdr *cbdr)
-{
- int size = cbdr->bd_count * sizeof(struct enetc_cbd);
-
- dma_free_coherent(cbdr->dma_dev, size, cbdr->bd_base,
- cbdr->bd_dma_base);
- cbdr->bd_base = NULL;
- cbdr->dma_dev = NULL;
-}
-
-void enetc_setup_cbdr(struct enetc_hw *hw, struct enetc_cbdr *cbdr)
-{
/* set CBDR cache attributes */
enetc_wr(hw, ENETC_SICAR2,
ENETC_SICAR_RD_COHERENT | ENETC_SICAR_WR_COHERENT);
cbdr->pir = hw->reg + ENETC_SICBDRPIR;
cbdr->cir = hw->reg + ENETC_SICBDRCIR;
+
+ return 0;
+}
+
+void enetc_free_cbdr(struct enetc_cbdr *cbdr)
+{
+ int size = cbdr->bd_count * sizeof(struct enetc_cbd);
+
+ dma_free_coherent(cbdr->dma_dev, size, cbdr->bd_base,
+ cbdr->bd_dma_base);
+ cbdr->bd_base = NULL;
+ cbdr->dma_dev = NULL;
}
void enetc_clear_cbdr(struct enetc_hw *hw)
int err;
si->cbd_ring.bd_count = ENETC_CBDR_DEFAULT_SIZE;
- err = enetc_alloc_cbdr(dev, &si->cbd_ring);
+ err = enetc_setup_cbdr(dev, hw, &si->cbd_ring);
if (err)
return;
- enetc_setup_cbdr(hw, &si->cbd_ring);
-
enetc_init_port_rfs_memory(si);
enetc_init_port_rss_memory(si);