{
}
+static void
+eth_promiscuous_enable(struct rte_eth_dev *dev)
+{
+ volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+ dev, SZEDATA2_CGMII_IBUF_BASE_OFF,
+ volatile struct szedata2_cgmii_ibuf *);
+ cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_PROMISC);
+}
+
+static void
+eth_promiscuous_disable(struct rte_eth_dev *dev)
+{
+ volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+ dev, SZEDATA2_CGMII_IBUF_BASE_OFF,
+ volatile struct szedata2_cgmii_ibuf *);
+ cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_ONLY_VALID);
+}
+
+static void
+eth_allmulticast_enable(struct rte_eth_dev *dev)
+{
+ volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+ dev, SZEDATA2_CGMII_IBUF_BASE_OFF,
+ volatile struct szedata2_cgmii_ibuf *);
+ cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_ALL_MULTICAST);
+}
+
+static void
+eth_allmulticast_disable(struct rte_eth_dev *dev)
+{
+ volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+ dev, SZEDATA2_CGMII_IBUF_BASE_OFF,
+ volatile struct szedata2_cgmii_ibuf *);
+ cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_ONLY_VALID);
+}
+
static struct eth_dev_ops ops = {
.dev_start = eth_dev_start,
.dev_stop = eth_dev_stop,
.dev_close = eth_dev_close,
.dev_configure = eth_dev_configure,
.dev_infos_get = eth_dev_info,
+ .promiscuous_enable = eth_promiscuous_enable,
+ .promiscuous_disable = eth_promiscuous_disable,
+ .allmulticast_enable = eth_allmulticast_enable,
+ .allmulticast_disable = eth_allmulticast_disable,
.rx_queue_start = eth_rx_queue_start,
.rx_queue_stop = eth_rx_queue_stop,
.tx_queue_start = eth_tx_queue_start,
(unsigned long long)pci_rsc->len,
(unsigned long long)pci_rsc->addr);
+ /* Get link state */
eth_link_update(dev, 0);
+ /* Allocate space for one mac address */
data->mac_addrs = rte_zmalloc(data->name, sizeof(struct ether_addr),
RTE_CACHE_LINE_SIZE);
if (data->mac_addrs == NULL) {
ether_addr_copy(ð_addr, data->mac_addrs);
+ /* At initial state COMBO card is in promiscuous mode so disable it */
+ eth_promiscuous_disable(dev);
+
RTE_LOG(INFO, PMD, "szedata2 device ("
PCI_PRI_FMT ") successfully initialized\n",
pci_addr->domain, pci_addr->bus, pci_addr->devid,
SZEDATA2_LINK_SPEED_100G,
};
+enum szedata2_mac_check_mode {
+ SZEDATA2_MAC_CHMODE_PROMISC = 0x0,
+ SZEDATA2_MAC_CHMODE_ONLY_VALID = 0x1,
+ SZEDATA2_MAC_CHMODE_ALL_BROADCAST = 0x2,
+ SZEDATA2_MAC_CHMODE_ALL_MULTICAST = 0x3,
+};
+
/*
* Structure describes CGMII IBUF address space
*/
return ((rte_le_to_cpu_32(ibuf->ibuf_st) & 0x80) != 0) ? true : false;
}
+/*
+ * @return
+ * MAC address check mode
+ */
+static inline enum szedata2_mac_check_mode
+cgmii_ibuf_mac_mode_read(volatile struct szedata2_cgmii_ibuf *ibuf)
+{
+ switch (rte_le_to_cpu_32(ibuf->mac_chmode) & 0x3) {
+ case 0x0:
+ return SZEDATA2_MAC_CHMODE_PROMISC;
+ case 0x1:
+ return SZEDATA2_MAC_CHMODE_ONLY_VALID;
+ case 0x2:
+ return SZEDATA2_MAC_CHMODE_ALL_BROADCAST;
+ case 0x3:
+ return SZEDATA2_MAC_CHMODE_ALL_MULTICAST;
+ default:
+ return SZEDATA2_MAC_CHMODE_PROMISC;
+ }
+}
+
+/*
+ * Writes "mode" in MAC address check mode register.
+ */
+static inline void
+cgmii_ibuf_mac_mode_write(volatile struct szedata2_cgmii_ibuf *ibuf,
+ enum szedata2_mac_check_mode mode)
+{
+ ibuf->mac_chmode = rte_cpu_to_le_32(
+ (rte_le_to_cpu_32(ibuf->mac_chmode) & ~0x3) | mode);
+}
+
/*
* Structure describes CGMII OBUF address space
*/