+static int axgbe_phy_reset(struct axgbe_port *pdata)
+{
+ pdata->phy_link = -1;
+ pdata->phy_speed = SPEED_UNKNOWN;
+ return pdata->phy_if.phy_reset(pdata);
+}
+
+/*
+ * Interrupt handler triggered by NIC for handling
+ * specific interrupt.
+ *
+ * @param handle
+ * Pointer to interrupt handle.
+ * @param param
+ * The address of parameter (struct rte_eth_dev *) registered before.
+ *
+ * @return
+ * void
+ */
+static void
+axgbe_dev_interrupt_handler(void *param)
+{
+ struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
+ struct axgbe_port *pdata = dev->data->dev_private;
+ unsigned int dma_isr, dma_ch_isr;
+
+ pdata->phy_if.an_isr(pdata);
+ /*DMA related interrupts*/
+ dma_isr = AXGMAC_IOREAD(pdata, DMA_ISR);
+ PMD_DRV_LOG(DEBUG, "DMA_ISR=%#010x\n", dma_isr);
+ if (dma_isr) {
+ if (dma_isr & 1) {
+ dma_ch_isr =
+ AXGMAC_DMA_IOREAD((struct axgbe_rx_queue *)
+ pdata->rx_queues[0],
+ DMA_CH_SR);
+ PMD_DRV_LOG(DEBUG, "DMA_CH0_ISR=%#010x\n", dma_ch_isr);
+ AXGMAC_DMA_IOWRITE((struct axgbe_rx_queue *)
+ pdata->rx_queues[0],
+ DMA_CH_SR, dma_ch_isr);
+ }
+ }
+ /* Unmask interrupts since disabled after generation */
+ rte_intr_ack(pdata->pci_dev->intr_handle);
+}
+
+/*
+ * Configure device link speed and setup link.
+ * It returns 0 on success.
+ */
+static int
+axgbe_dev_configure(struct rte_eth_dev *dev)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ /* Checksum offload to hardware */
+ pdata->rx_csum_enable = dev->data->dev_conf.rxmode.offloads &
+ RTE_ETH_RX_OFFLOAD_CHECKSUM;
+ return 0;
+}
+
+static int
+axgbe_dev_rx_mq_config(struct rte_eth_dev *dev)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ if (dev->data->dev_conf.rxmode.mq_mode == RTE_ETH_MQ_RX_RSS)
+ pdata->rss_enable = 1;
+ else if (dev->data->dev_conf.rxmode.mq_mode == RTE_ETH_MQ_RX_NONE)
+ pdata->rss_enable = 0;
+ else
+ return -1;
+ return 0;
+}
+
+static int
+axgbe_dev_start(struct rte_eth_dev *dev)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ int ret;
+ struct rte_eth_dev_data *dev_data = dev->data;
+ uint16_t max_pkt_len;
+
+ dev->dev_ops = &axgbe_eth_dev_ops;
+
+ PMD_INIT_FUNC_TRACE();
+
+ /* Multiqueue RSS */
+ ret = axgbe_dev_rx_mq_config(dev);
+ if (ret) {
+ PMD_DRV_LOG(ERR, "Unable to config RX MQ\n");
+ return ret;
+ }
+ ret = axgbe_phy_reset(pdata);
+ if (ret) {
+ PMD_DRV_LOG(ERR, "phy reset failed\n");
+ return ret;
+ }
+ ret = pdata->hw_if.init(pdata);
+ if (ret) {
+ PMD_DRV_LOG(ERR, "dev_init failed\n");
+ return ret;
+ }
+
+ /* enable uio/vfio intr/eventfd mapping */
+ rte_intr_enable(pdata->pci_dev->intr_handle);
+
+ /* phy start*/
+ pdata->phy_if.phy_start(pdata);
+ axgbe_dev_enable_tx(dev);
+ axgbe_dev_enable_rx(dev);
+
+ rte_bit_relaxed_clear32(AXGBE_STOPPED, &pdata->dev_state);
+ rte_bit_relaxed_clear32(AXGBE_DOWN, &pdata->dev_state);
+
+ max_pkt_len = dev_data->mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
+ if ((dev_data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_SCATTER) ||
+ max_pkt_len > pdata->rx_buf_size)
+ dev_data->scattered_rx = 1;
+
+ /* Scatter Rx handling */
+ if (dev_data->scattered_rx)
+ dev->rx_pkt_burst = ð_axgbe_recv_scattered_pkts;
+ else
+ dev->rx_pkt_burst = &axgbe_recv_pkts;
+
+ return 0;
+}
+
+/* Stop device: disable rx and tx functions to allow for reconfiguring. */
+static int
+axgbe_dev_stop(struct rte_eth_dev *dev)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ PMD_INIT_FUNC_TRACE();
+
+ rte_intr_disable(pdata->pci_dev->intr_handle);
+
+ if (rte_bit_relaxed_get32(AXGBE_STOPPED, &pdata->dev_state))
+ return 0;
+
+ rte_bit_relaxed_set32(AXGBE_STOPPED, &pdata->dev_state);
+ axgbe_dev_disable_tx(dev);
+ axgbe_dev_disable_rx(dev);
+
+ pdata->phy_if.phy_stop(pdata);
+ pdata->hw_if.exit(pdata);
+ memset(&dev->data->dev_link, 0, sizeof(struct rte_eth_link));
+ rte_bit_relaxed_set32(AXGBE_DOWN, &pdata->dev_state);
+
+ return 0;
+}
+
+static int
+axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ PMD_INIT_FUNC_TRACE();
+
+ AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 1);
+
+ return 0;
+}
+
+static int
+axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ PMD_INIT_FUNC_TRACE();
+
+ AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 0);
+
+ return 0;
+}
+
+static int
+axgbe_dev_allmulticast_enable(struct rte_eth_dev *dev)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (AXGMAC_IOREAD_BITS(pdata, MAC_PFR, PM))
+ return 0;
+ AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PM, 1);
+
+ return 0;
+}
+
+static int
+axgbe_dev_allmulticast_disable(struct rte_eth_dev *dev)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (!AXGMAC_IOREAD_BITS(pdata, MAC_PFR, PM))
+ return 0;
+ AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PM, 0);
+
+ return 0;
+}
+
+static int
+axgbe_dev_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ /* Set Default MAC Addr */
+ axgbe_set_mac_addn_addr(pdata, (u8 *)mac_addr, 0);
+
+ return 0;
+}
+
+static int
+axgbe_dev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
+ uint32_t index, uint32_t pool __rte_unused)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ struct axgbe_hw_features *hw_feat = &pdata->hw_feat;
+
+ if (index > hw_feat->addn_mac) {
+ PMD_DRV_LOG(ERR, "Invalid Index %d\n", index);
+ return -EINVAL;
+ }
+ axgbe_set_mac_addn_addr(pdata, (u8 *)mac_addr, index);
+ return 0;
+}
+
+static int
+axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ unsigned int i, idx, shift;
+ int ret;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (reta_size == 0 || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
+ PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < reta_size; i++) {
+ idx = i / RTE_ETH_RETA_GROUP_SIZE;
+ shift = i % RTE_ETH_RETA_GROUP_SIZE;
+ if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
+ continue;
+ pdata->rss_table[i] = reta_conf[idx].reta[shift];
+ }
+
+ /* Program the lookup table */
+ ret = axgbe_write_rss_lookup_table(pdata);
+ return ret;
+}
+
+static int
+axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ unsigned int i, idx, shift;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (reta_size == 0 || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
+ PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < reta_size; i++) {
+ idx = i / RTE_ETH_RETA_GROUP_SIZE;
+ shift = i % RTE_ETH_RETA_GROUP_SIZE;
+ if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
+ continue;
+ reta_conf[idx].reta[shift] = pdata->rss_table[i];
+ }
+ return 0;
+}
+
+static int
+axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ int ret;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (rss_conf == NULL) {
+ PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
+ return -EINVAL;
+ }
+
+ if (rss_conf->rss_key != NULL &&
+ rss_conf->rss_key_len == AXGBE_RSS_HASH_KEY_SIZE) {
+ rte_memcpy(pdata->rss_key, rss_conf->rss_key,
+ AXGBE_RSS_HASH_KEY_SIZE);
+ /* Program the hash key */
+ ret = axgbe_write_rss_hash_key(pdata);
+ if (ret != 0)
+ return ret;
+ }
+
+ pdata->rss_hf = rss_conf->rss_hf & AXGBE_RSS_OFFLOAD;
+
+ if (pdata->rss_hf & (RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_IPV6))
+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1);
+ if (pdata->rss_hf &
+ (RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_NONFRAG_IPV6_TCP))
+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1);
+ if (pdata->rss_hf &
+ (RTE_ETH_RSS_NONFRAG_IPV4_UDP | RTE_ETH_RSS_NONFRAG_IPV6_UDP))
+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1);
+
+ /* Set the RSS options */
+ AXGMAC_IOWRITE(pdata, MAC_RSSCR, pdata->rss_options);
+
+ return 0;
+}
+
+static int
+axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (rss_conf == NULL) {
+ PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
+ return -EINVAL;
+ }
+
+ if (rss_conf->rss_key != NULL &&
+ rss_conf->rss_key_len >= AXGBE_RSS_HASH_KEY_SIZE) {
+ rte_memcpy(rss_conf->rss_key, pdata->rss_key,
+ AXGBE_RSS_HASH_KEY_SIZE);
+ }
+ rss_conf->rss_key_len = AXGBE_RSS_HASH_KEY_SIZE;
+ rss_conf->rss_hf = pdata->rss_hf;
+ return 0;
+}
+
+static int
+axgbe_dev_reset(struct rte_eth_dev *dev)
+{
+ int ret = 0;
+
+ ret = axgbe_dev_close(dev);
+ if (ret)
+ return ret;
+
+ ret = eth_axgbe_dev_init(dev);
+
+ return ret;
+}
+
+static void
+axgbe_dev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ struct axgbe_hw_features *hw_feat = &pdata->hw_feat;
+
+ if (index > hw_feat->addn_mac) {
+ PMD_DRV_LOG(ERR, "Invalid Index %d\n", index);
+ return;
+ }
+ axgbe_set_mac_addn_addr(pdata, NULL, index);
+}
+
+static int
+axgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev,
+ struct rte_ether_addr *mc_addr_set,
+ uint32_t nb_mc_addr)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ struct axgbe_hw_features *hw_feat = &pdata->hw_feat;
+ uint32_t index = 1; /* 0 is always default mac */
+ uint32_t i;
+
+ if (nb_mc_addr > hw_feat->addn_mac) {
+ PMD_DRV_LOG(ERR, "Invalid Index %d\n", nb_mc_addr);
+ return -EINVAL;
+ }
+
+ /* clear unicast addresses */
+ for (i = 1; i < hw_feat->addn_mac; i++) {
+ if (rte_is_zero_ether_addr(&dev->data->mac_addrs[i]))
+ continue;
+ memset(&dev->data->mac_addrs[i], 0,
+ sizeof(struct rte_ether_addr));
+ }
+
+ while (nb_mc_addr--)
+ axgbe_set_mac_addn_addr(pdata, (u8 *)mc_addr_set++, index++);
+
+ return 0;
+}
+
+static int
+axgbe_dev_uc_hash_table_set(struct rte_eth_dev *dev,
+ struct rte_ether_addr *mac_addr, uint8_t add)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ struct axgbe_hw_features *hw_feat = &pdata->hw_feat;
+
+ if (!hw_feat->hash_table_size) {
+ PMD_DRV_LOG(ERR, "MAC Hash Table not supported\n");
+ return -ENOTSUP;
+ }
+
+ axgbe_set_mac_hash_table(pdata, (u8 *)mac_addr, add);
+
+ if (pdata->uc_hash_mac_addr > 0) {
+ AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, HPF, 1);
+ AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, HUC, 1);
+ } else {
+ AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, HPF, 0);
+ AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, HUC, 0);
+ }
+ return 0;
+}
+
+static int
+axgbe_dev_uc_all_hash_table_set(struct rte_eth_dev *dev, uint8_t add)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ struct axgbe_hw_features *hw_feat = &pdata->hw_feat;
+ uint32_t index;
+
+ if (!hw_feat->hash_table_size) {
+ PMD_DRV_LOG(ERR, "MAC Hash Table not supported\n");
+ return -ENOTSUP;
+ }
+
+ for (index = 0; index < pdata->hash_table_count; index++) {
+ if (add)
+ pdata->uc_hash_table[index] = ~0;
+ else
+ pdata->uc_hash_table[index] = 0;
+
+ PMD_DRV_LOG(DEBUG, "%s MAC hash table at Index %#x\n",
+ add ? "set" : "clear", index);
+
+ AXGMAC_IOWRITE(pdata, MAC_HTR(index),
+ pdata->uc_hash_table[index]);
+ }
+
+ if (add) {
+ AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, HPF, 1);
+ AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, HUC, 1);
+ } else {
+ AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, HPF, 0);
+ AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, HUC, 0);
+ }
+ return 0;
+}
+
+/* return 0 means link status changed, -1 means not changed */
+static int
+axgbe_dev_link_update(struct rte_eth_dev *dev,
+ int wait_to_complete __rte_unused)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ struct rte_eth_link link;
+ int ret = 0;
+
+ PMD_INIT_FUNC_TRACE();
+ rte_delay_ms(800);
+
+ pdata->phy_if.phy_status(pdata);
+
+ memset(&link, 0, sizeof(struct rte_eth_link));
+ link.link_duplex = pdata->phy.duplex;
+ link.link_status = pdata->phy_link;
+ link.link_speed = pdata->phy_speed;
+ link.link_autoneg = !(dev->data->dev_conf.link_speeds &
+ RTE_ETH_LINK_SPEED_FIXED);
+ ret = rte_eth_linkstatus_set(dev, &link);
+ if (ret == -1)
+ PMD_DRV_LOG(ERR, "No change in link status\n");
+
+ return ret;
+}
+
+static int
+axgbe_dev_get_regs(struct rte_eth_dev *dev, struct rte_dev_reg_info *regs)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ if (regs->data == NULL) {
+ regs->length = axgbe_regs_get_count(pdata);
+ regs->width = sizeof(uint32_t);
+ return 0;
+ }
+
+ /* Only full register dump is supported */
+ if (regs->length &&
+ regs->length != (uint32_t)axgbe_regs_get_count(pdata))
+ return -ENOTSUP;
+
+ regs->version = pdata->pci_dev->id.vendor_id << 16 |
+ pdata->pci_dev->id.device_id;
+ axgbe_regs_dump(pdata, regs->data);
+ return 0;
+}
+static void axgbe_read_mmc_stats(struct axgbe_port *pdata)
+{
+ struct axgbe_mmc_stats *stats = &pdata->mmc_stats;
+
+ /* Freeze counters */
+ AXGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 1);
+
+ /* Tx counters */
+ stats->txoctetcount_gb +=
+ AXGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_GB_LO);
+ stats->txoctetcount_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_GB_HI) << 32);
+
+ stats->txframecount_gb +=
+ AXGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_GB_LO);
+ stats->txframecount_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_GB_HI) << 32);
+
+ stats->txbroadcastframes_g +=
+ AXGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_G_LO);
+ stats->txbroadcastframes_g +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_G_HI) << 32);
+
+ stats->txmulticastframes_g +=
+ AXGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_G_LO);
+ stats->txmulticastframes_g +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_G_HI) << 32);
+
+ stats->tx64octets_gb +=
+ AXGMAC_IOREAD(pdata, MMC_TX64OCTETS_GB_LO);
+ stats->tx64octets_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TX64OCTETS_GB_HI) << 32);
+
+ stats->tx65to127octets_gb +=
+ AXGMAC_IOREAD(pdata, MMC_TX65TO127OCTETS_GB_LO);
+ stats->tx65to127octets_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TX65TO127OCTETS_GB_HI) << 32);
+
+ stats->tx128to255octets_gb +=
+ AXGMAC_IOREAD(pdata, MMC_TX128TO255OCTETS_GB_LO);
+ stats->tx128to255octets_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TX128TO255OCTETS_GB_HI) << 32);
+
+ stats->tx256to511octets_gb +=
+ AXGMAC_IOREAD(pdata, MMC_TX256TO511OCTETS_GB_LO);
+ stats->tx256to511octets_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TX256TO511OCTETS_GB_HI) << 32);
+
+ stats->tx512to1023octets_gb +=
+ AXGMAC_IOREAD(pdata, MMC_TX512TO1023OCTETS_GB_LO);
+ stats->tx512to1023octets_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TX512TO1023OCTETS_GB_HI) << 32);
+
+ stats->tx1024tomaxoctets_gb +=
+ AXGMAC_IOREAD(pdata, MMC_TX1024TOMAXOCTETS_GB_LO);
+ stats->tx1024tomaxoctets_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TX1024TOMAXOCTETS_GB_HI) << 32);
+
+ stats->txunicastframes_gb +=
+ AXGMAC_IOREAD(pdata, MMC_TXUNICASTFRAMES_GB_LO);
+ stats->txunicastframes_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TXUNICASTFRAMES_GB_HI) << 32);
+
+ stats->txmulticastframes_gb +=
+ AXGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_GB_LO);
+ stats->txmulticastframes_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_GB_HI) << 32);
+
+ stats->txbroadcastframes_g +=
+ AXGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_GB_LO);
+ stats->txbroadcastframes_g +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_GB_HI) << 32);
+
+ stats->txunderflowerror +=
+ AXGMAC_IOREAD(pdata, MMC_TXUNDERFLOWERROR_LO);
+ stats->txunderflowerror +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TXUNDERFLOWERROR_HI) << 32);
+
+ stats->txoctetcount_g +=
+ AXGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_G_LO);
+ stats->txoctetcount_g +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_G_HI) << 32);
+
+ stats->txframecount_g +=
+ AXGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_G_LO);
+ stats->txframecount_g +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_G_HI) << 32);
+
+ stats->txpauseframes +=
+ AXGMAC_IOREAD(pdata, MMC_TXPAUSEFRAMES_LO);
+ stats->txpauseframes +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TXPAUSEFRAMES_HI) << 32);
+
+ stats->txvlanframes_g +=
+ AXGMAC_IOREAD(pdata, MMC_TXVLANFRAMES_G_LO);
+ stats->txvlanframes_g +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_TXVLANFRAMES_G_HI) << 32);
+
+ /* Rx counters */
+ stats->rxframecount_gb +=
+ AXGMAC_IOREAD(pdata, MMC_RXFRAMECOUNT_GB_LO);
+ stats->rxframecount_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RXFRAMECOUNT_GB_HI) << 32);
+
+ stats->rxoctetcount_gb +=
+ AXGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_GB_LO);
+ stats->rxoctetcount_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_GB_HI) << 32);
+
+ stats->rxoctetcount_g +=
+ AXGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_G_LO);
+ stats->rxoctetcount_g +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_G_HI) << 32);
+
+ stats->rxbroadcastframes_g +=
+ AXGMAC_IOREAD(pdata, MMC_RXBROADCASTFRAMES_G_LO);
+ stats->rxbroadcastframes_g +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RXBROADCASTFRAMES_G_HI) << 32);
+
+ stats->rxmulticastframes_g +=
+ AXGMAC_IOREAD(pdata, MMC_RXMULTICASTFRAMES_G_LO);
+ stats->rxmulticastframes_g +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RXMULTICASTFRAMES_G_HI) << 32);
+
+ stats->rxcrcerror +=
+ AXGMAC_IOREAD(pdata, MMC_RXCRCERROR_LO);
+ stats->rxcrcerror +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RXCRCERROR_HI) << 32);
+
+ stats->rxrunterror +=
+ AXGMAC_IOREAD(pdata, MMC_RXRUNTERROR);
+
+ stats->rxjabbererror +=
+ AXGMAC_IOREAD(pdata, MMC_RXJABBERERROR);
+
+ stats->rxundersize_g +=
+ AXGMAC_IOREAD(pdata, MMC_RXUNDERSIZE_G);
+
+ stats->rxoversize_g +=
+ AXGMAC_IOREAD(pdata, MMC_RXOVERSIZE_G);
+
+ stats->rx64octets_gb +=
+ AXGMAC_IOREAD(pdata, MMC_RX64OCTETS_GB_LO);
+ stats->rx64octets_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RX64OCTETS_GB_HI) << 32);
+
+ stats->rx65to127octets_gb +=
+ AXGMAC_IOREAD(pdata, MMC_RX65TO127OCTETS_GB_LO);
+ stats->rx65to127octets_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RX65TO127OCTETS_GB_HI) << 32);
+
+ stats->rx128to255octets_gb +=
+ AXGMAC_IOREAD(pdata, MMC_RX128TO255OCTETS_GB_LO);
+ stats->rx128to255octets_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RX128TO255OCTETS_GB_HI) << 32);
+
+ stats->rx256to511octets_gb +=
+ AXGMAC_IOREAD(pdata, MMC_RX256TO511OCTETS_GB_LO);
+ stats->rx256to511octets_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RX256TO511OCTETS_GB_HI) << 32);
+
+ stats->rx512to1023octets_gb +=
+ AXGMAC_IOREAD(pdata, MMC_RX512TO1023OCTETS_GB_LO);
+ stats->rx512to1023octets_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RX512TO1023OCTETS_GB_HI) << 32);
+
+ stats->rx1024tomaxoctets_gb +=
+ AXGMAC_IOREAD(pdata, MMC_RX1024TOMAXOCTETS_GB_LO);
+ stats->rx1024tomaxoctets_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RX1024TOMAXOCTETS_GB_HI) << 32);
+
+ stats->rxunicastframes_g +=
+ AXGMAC_IOREAD(pdata, MMC_RXUNICASTFRAMES_G_LO);
+ stats->rxunicastframes_g +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RXUNICASTFRAMES_G_HI) << 32);
+
+ stats->rxlengtherror +=
+ AXGMAC_IOREAD(pdata, MMC_RXLENGTHERROR_LO);
+ stats->rxlengtherror +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RXLENGTHERROR_HI) << 32);
+
+ stats->rxoutofrangetype +=
+ AXGMAC_IOREAD(pdata, MMC_RXOUTOFRANGETYPE_LO);
+ stats->rxoutofrangetype +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RXOUTOFRANGETYPE_HI) << 32);
+
+ stats->rxpauseframes +=
+ AXGMAC_IOREAD(pdata, MMC_RXPAUSEFRAMES_LO);
+ stats->rxpauseframes +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RXPAUSEFRAMES_HI) << 32);
+
+ stats->rxfifooverflow +=
+ AXGMAC_IOREAD(pdata, MMC_RXFIFOOVERFLOW_LO);
+ stats->rxfifooverflow +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RXFIFOOVERFLOW_HI) << 32);
+
+ stats->rxvlanframes_gb +=
+ AXGMAC_IOREAD(pdata, MMC_RXVLANFRAMES_GB_LO);
+ stats->rxvlanframes_gb +=
+ ((uint64_t)AXGMAC_IOREAD(pdata, MMC_RXVLANFRAMES_GB_HI) << 32);
+
+ stats->rxwatchdogerror +=
+ AXGMAC_IOREAD(pdata, MMC_RXWATCHDOGERROR);
+
+ /* Un-freeze counters */
+ AXGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 0);
+}
+
+static int
+axgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats,
+ unsigned int n)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ unsigned int i;
+
+ if (!stats)
+ return 0;
+
+ axgbe_read_mmc_stats(pdata);
+
+ for (i = 0; i < n && i < AXGBE_XSTATS_COUNT; i++) {
+ stats[i].id = i;
+ stats[i].value = *(u64 *)((uint8_t *)&pdata->mmc_stats +
+ axgbe_xstats_strings[i].offset);
+ }
+
+ return i;
+}
+
+static int
+axgbe_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int n)
+{
+ unsigned int i;
+
+ if (n >= AXGBE_XSTATS_COUNT && xstats_names) {
+ for (i = 0; i < AXGBE_XSTATS_COUNT; ++i) {
+ snprintf(xstats_names[i].name,
+ RTE_ETH_XSTATS_NAME_SIZE, "%s",
+ axgbe_xstats_strings[i].name);
+ }
+ }
+
+ return AXGBE_XSTATS_COUNT;
+}
+
+static int
+axgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
+ uint64_t *values, unsigned int n)
+{
+ unsigned int i;
+ uint64_t values_copy[AXGBE_XSTATS_COUNT];
+
+ if (!ids) {
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ if (n < AXGBE_XSTATS_COUNT)
+ return AXGBE_XSTATS_COUNT;
+
+ axgbe_read_mmc_stats(pdata);
+
+ for (i = 0; i < AXGBE_XSTATS_COUNT; i++) {
+ values[i] = *(u64 *)((uint8_t *)&pdata->mmc_stats +
+ axgbe_xstats_strings[i].offset);
+ }
+
+ return i;
+ }
+
+ axgbe_dev_xstats_get_by_id(dev, NULL, values_copy, AXGBE_XSTATS_COUNT);
+
+ for (i = 0; i < n; i++) {
+ if (ids[i] >= AXGBE_XSTATS_COUNT) {
+ PMD_DRV_LOG(ERR, "id value isn't valid\n");
+ return -1;
+ }
+ values[i] = values_copy[ids[i]];
+ }
+ return n;
+}
+
+static int
+axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
+ const uint64_t *ids,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int size)
+{
+ struct rte_eth_xstat_name xstats_names_copy[AXGBE_XSTATS_COUNT];
+ unsigned int i;
+
+ if (!ids)
+ return axgbe_dev_xstats_get_names(dev, xstats_names, size);
+
+ axgbe_dev_xstats_get_names(dev, xstats_names_copy, size);
+
+ for (i = 0; i < size; i++) {
+ if (ids[i] >= AXGBE_XSTATS_COUNT) {
+ PMD_DRV_LOG(ERR, "id value isn't valid\n");
+ return -1;
+ }
+ strcpy(xstats_names[i].name, xstats_names_copy[ids[i]].name);
+ }
+ return size;
+}
+
+static int
+axgbe_dev_xstats_reset(struct rte_eth_dev *dev)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ struct axgbe_mmc_stats *stats = &pdata->mmc_stats;
+
+ /* MMC registers are configured for reset on read */
+ axgbe_read_mmc_stats(pdata);
+
+ /* Reset stats */
+ memset(stats, 0, sizeof(*stats));
+
+ return 0;
+}
+
+static int
+axgbe_dev_stats_get(struct rte_eth_dev *dev,
+ struct rte_eth_stats *stats)
+{
+ struct axgbe_rx_queue *rxq;
+ struct axgbe_tx_queue *txq;
+ struct axgbe_port *pdata = dev->data->dev_private;
+ struct axgbe_mmc_stats *mmc_stats = &pdata->mmc_stats;
+ unsigned int i;
+
+ axgbe_read_mmc_stats(pdata);
+
+ stats->imissed = mmc_stats->rxfifooverflow;
+
+ for (i = 0; i < dev->data->nb_rx_queues; i++) {
+ rxq = dev->data->rx_queues[i];
+ if (rxq) {
+ stats->q_ipackets[i] = rxq->pkts;
+ stats->ipackets += rxq->pkts;
+ stats->q_ibytes[i] = rxq->bytes;
+ stats->ibytes += rxq->bytes;
+ stats->rx_nombuf += rxq->rx_mbuf_alloc_failed;
+ stats->q_errors[i] = rxq->errors
+ + rxq->rx_mbuf_alloc_failed;
+ stats->ierrors += rxq->errors;
+ } else {
+ PMD_DRV_LOG(DEBUG, "Rx queue not setup for port %d\n",
+ dev->data->port_id);
+ }
+ }
+
+ for (i = 0; i < dev->data->nb_tx_queues; i++) {
+ txq = dev->data->tx_queues[i];
+ if (txq) {
+ stats->q_opackets[i] = txq->pkts;
+ stats->opackets += txq->pkts;
+ stats->q_obytes[i] = txq->bytes;
+ stats->obytes += txq->bytes;
+ stats->oerrors += txq->errors;
+ } else {
+ PMD_DRV_LOG(DEBUG, "Tx queue not setup for port %d\n",
+ dev->data->port_id);
+ }
+ }
+
+ return 0;
+}
+
+static int
+axgbe_dev_stats_reset(struct rte_eth_dev *dev)
+{
+ struct axgbe_rx_queue *rxq;
+ struct axgbe_tx_queue *txq;
+ unsigned int i;
+
+ for (i = 0; i < dev->data->nb_rx_queues; i++) {
+ rxq = dev->data->rx_queues[i];
+ if (rxq) {
+ rxq->pkts = 0;
+ rxq->bytes = 0;
+ rxq->errors = 0;
+ rxq->rx_mbuf_alloc_failed = 0;
+ } else {
+ PMD_DRV_LOG(DEBUG, "Rx queue not setup for port %d\n",
+ dev->data->port_id);
+ }
+ }
+ for (i = 0; i < dev->data->nb_tx_queues; i++) {
+ txq = dev->data->tx_queues[i];
+ if (txq) {
+ txq->pkts = 0;
+ txq->bytes = 0;
+ txq->errors = 0;
+ } else {
+ PMD_DRV_LOG(DEBUG, "Tx queue not setup for port %d\n",
+ dev->data->port_id);
+ }
+ }
+
+ return 0;
+}
+
+static int
+axgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ dev_info->max_rx_queues = pdata->rx_ring_count;
+ dev_info->max_tx_queues = pdata->tx_ring_count;
+ dev_info->min_rx_bufsize = AXGBE_RX_MIN_BUF_SIZE;
+ dev_info->max_rx_pktlen = AXGBE_RX_MAX_BUF_SIZE;
+ dev_info->max_mac_addrs = pdata->hw_feat.addn_mac + 1;
+ dev_info->max_hash_mac_addrs = pdata->hw_feat.hash_table_size;
+ dev_info->speed_capa = RTE_ETH_LINK_SPEED_10G;
+
+ dev_info->rx_offload_capa =
+ RTE_ETH_RX_OFFLOAD_VLAN_STRIP |
+ RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
+ RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |
+ RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |
+ RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
+ RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
+ RTE_ETH_RX_OFFLOAD_SCATTER |
+ RTE_ETH_RX_OFFLOAD_KEEP_CRC;
+
+ dev_info->tx_offload_capa =
+ RTE_ETH_TX_OFFLOAD_VLAN_INSERT |
+ RTE_ETH_TX_OFFLOAD_QINQ_INSERT |
+ RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
+ RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
+ RTE_ETH_TX_OFFLOAD_TCP_CKSUM;
+
+ if (pdata->hw_feat.rss) {
+ dev_info->flow_type_rss_offloads = AXGBE_RSS_OFFLOAD;
+ dev_info->reta_size = pdata->hw_feat.hash_table_size;
+ dev_info->hash_key_size = AXGBE_RSS_HASH_KEY_SIZE;
+ }
+
+ dev_info->rx_desc_lim = rx_desc_lim;
+ dev_info->tx_desc_lim = tx_desc_lim;
+
+ dev_info->default_rxconf = (struct rte_eth_rxconf) {
+ .rx_free_thresh = AXGBE_RX_FREE_THRESH,
+ };
+
+ dev_info->default_txconf = (struct rte_eth_txconf) {
+ .tx_free_thresh = AXGBE_TX_FREE_THRESH,
+ };
+
+ return 0;
+}
+
+static int
+axgbe_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ struct xgbe_fc_info fc = pdata->fc;
+ unsigned int reg, reg_val = 0;
+
+ reg = MAC_Q0TFCR;
+ reg_val = AXGMAC_IOREAD(pdata, reg);
+ fc.low_water[0] = AXGMAC_MTL_IOREAD_BITS(pdata, 0, MTL_Q_RQFCR, RFA);
+ fc.high_water[0] = AXGMAC_MTL_IOREAD_BITS(pdata, 0, MTL_Q_RQFCR, RFD);
+ fc.pause_time[0] = AXGMAC_GET_BITS(reg_val, MAC_Q0TFCR, PT);
+ fc.autoneg = pdata->pause_autoneg;
+
+ if (pdata->rx_pause && pdata->tx_pause)
+ fc.mode = RTE_ETH_FC_FULL;
+ else if (pdata->rx_pause)
+ fc.mode = RTE_ETH_FC_RX_PAUSE;
+ else if (pdata->tx_pause)
+ fc.mode = RTE_ETH_FC_TX_PAUSE;
+ else
+ fc.mode = RTE_ETH_FC_NONE;
+
+ fc_conf->high_water = (1024 + (fc.low_water[0] << 9)) / 1024;
+ fc_conf->low_water = (1024 + (fc.high_water[0] << 9)) / 1024;
+ fc_conf->pause_time = fc.pause_time[0];
+ fc_conf->send_xon = fc.send_xon;
+ fc_conf->mode = fc.mode;
+
+ return 0;
+}
+
+static int
+axgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ struct xgbe_fc_info fc = pdata->fc;
+ unsigned int reg, reg_val = 0;
+ reg = MAC_Q0TFCR;
+
+ pdata->pause_autoneg = fc_conf->autoneg;
+ pdata->phy.pause_autoneg = pdata->pause_autoneg;
+ fc.send_xon = fc_conf->send_xon;
+ AXGMAC_MTL_IOWRITE_BITS(pdata, 0, MTL_Q_RQFCR, RFA,
+ AXGMAC_FLOW_CONTROL_VALUE(1024 * fc_conf->high_water));
+ AXGMAC_MTL_IOWRITE_BITS(pdata, 0, MTL_Q_RQFCR, RFD,
+ AXGMAC_FLOW_CONTROL_VALUE(1024 * fc_conf->low_water));
+ AXGMAC_SET_BITS(reg_val, MAC_Q0TFCR, PT, fc_conf->pause_time);
+ AXGMAC_IOWRITE(pdata, reg, reg_val);
+ fc.mode = fc_conf->mode;
+
+ if (fc.mode == RTE_ETH_FC_FULL) {
+ pdata->tx_pause = 1;
+ pdata->rx_pause = 1;
+ } else if (fc.mode == RTE_ETH_FC_RX_PAUSE) {
+ pdata->tx_pause = 0;
+ pdata->rx_pause = 1;
+ } else if (fc.mode == RTE_ETH_FC_TX_PAUSE) {
+ pdata->tx_pause = 1;
+ pdata->rx_pause = 0;
+ } else {
+ pdata->tx_pause = 0;
+ pdata->rx_pause = 0;
+ }
+
+ if (pdata->tx_pause != (unsigned int)pdata->phy.tx_pause)
+ pdata->hw_if.config_tx_flow_control(pdata);
+
+ if (pdata->rx_pause != (unsigned int)pdata->phy.rx_pause)
+ pdata->hw_if.config_rx_flow_control(pdata);
+
+ pdata->hw_if.config_flow_control(pdata);
+ pdata->phy.tx_pause = pdata->tx_pause;
+ pdata->phy.rx_pause = pdata->rx_pause;
+
+ return 0;
+}
+
+static int
+axgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev,
+ struct rte_eth_pfc_conf *pfc_conf)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ struct xgbe_fc_info fc = pdata->fc;
+ uint8_t tc_num;
+
+ tc_num = pdata->pfc_map[pfc_conf->priority];
+
+ if (pfc_conf->priority >= pdata->hw_feat.tc_cnt) {
+ PMD_INIT_LOG(ERR, "Max supported traffic class: %d\n",
+ pdata->hw_feat.tc_cnt);
+ return -EINVAL;
+ }
+
+ pdata->pause_autoneg = pfc_conf->fc.autoneg;
+ pdata->phy.pause_autoneg = pdata->pause_autoneg;
+ fc.send_xon = pfc_conf->fc.send_xon;
+ AXGMAC_MTL_IOWRITE_BITS(pdata, tc_num, MTL_Q_RQFCR, RFA,
+ AXGMAC_FLOW_CONTROL_VALUE(1024 * pfc_conf->fc.high_water));
+ AXGMAC_MTL_IOWRITE_BITS(pdata, tc_num, MTL_Q_RQFCR, RFD,
+ AXGMAC_FLOW_CONTROL_VALUE(1024 * pfc_conf->fc.low_water));
+
+ switch (tc_num) {
+ case 0:
+ AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM0R,
+ PSTC0, pfc_conf->fc.pause_time);
+ break;
+ case 1:
+ AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM0R,
+ PSTC1, pfc_conf->fc.pause_time);
+ break;
+ case 2:
+ AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM0R,
+ PSTC2, pfc_conf->fc.pause_time);
+ break;
+ case 3:
+ AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM0R,
+ PSTC3, pfc_conf->fc.pause_time);
+ break;
+ case 4:
+ AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM1R,
+ PSTC4, pfc_conf->fc.pause_time);
+ break;
+ case 5:
+ AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM1R,
+ PSTC5, pfc_conf->fc.pause_time);
+ break;
+ case 7:
+ AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM1R,
+ PSTC6, pfc_conf->fc.pause_time);
+ break;
+ case 6:
+ AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM1R,
+ PSTC7, pfc_conf->fc.pause_time);
+ break;
+ }
+
+ fc.mode = pfc_conf->fc.mode;
+
+ if (fc.mode == RTE_ETH_FC_FULL) {
+ pdata->tx_pause = 1;
+ pdata->rx_pause = 1;
+ AXGMAC_IOWRITE_BITS(pdata, MAC_RFCR, PFCE, 1);
+ } else if (fc.mode == RTE_ETH_FC_RX_PAUSE) {
+ pdata->tx_pause = 0;
+ pdata->rx_pause = 1;
+ AXGMAC_IOWRITE_BITS(pdata, MAC_RFCR, PFCE, 1);
+ } else if (fc.mode == RTE_ETH_FC_TX_PAUSE) {
+ pdata->tx_pause = 1;
+ pdata->rx_pause = 0;
+ AXGMAC_IOWRITE_BITS(pdata, MAC_RFCR, PFCE, 0);
+ } else {
+ pdata->tx_pause = 0;
+ pdata->rx_pause = 0;
+ AXGMAC_IOWRITE_BITS(pdata, MAC_RFCR, PFCE, 0);
+ }
+
+ if (pdata->tx_pause != (unsigned int)pdata->phy.tx_pause)
+ pdata->hw_if.config_tx_flow_control(pdata);
+
+ if (pdata->rx_pause != (unsigned int)pdata->phy.rx_pause)
+ pdata->hw_if.config_rx_flow_control(pdata);
+ pdata->hw_if.config_flow_control(pdata);
+ pdata->phy.tx_pause = pdata->tx_pause;
+ pdata->phy.rx_pause = pdata->rx_pause;