From: <wanry@3snic.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@amd.com>, Renyong Wan <wanry@3snic.com>,
Steven Song <steven.song@3snic.com>
Subject: [PATCH v5 11/32] net/sssnic: add dev MAC ops
Date: Mon, 4 Sep 2023 12:56:37 +0800 [thread overview]
Message-ID: <20230904045658.238185-12-wanry@3snic.com> (raw)
In-Reply-To: <20230904045658.238185-1-wanry@3snic.com>
From: Renyong Wan <wanry@3snic.com>
Signed-off-by: Steven Song <steven.song@3snic.com>
Signed-off-by: Renyong Wan <wanry@3snic.com>
---
doc/guides/nics/features/sssnic.ini | 2 +
drivers/net/sssnic/base/sssnic_api.c | 174 +++++++++++++++++
drivers/net/sssnic/base/sssnic_api.h | 4 +
drivers/net/sssnic/base/sssnic_cmd.h | 25 +++
drivers/net/sssnic/base/sssnic_hw.h | 1 +
drivers/net/sssnic/sssnic_ethdev.c | 270 ++++++++++++++++++++++++++-
drivers/net/sssnic/sssnic_ethdev.h | 2 +
7 files changed, 477 insertions(+), 1 deletion(-)
diff --git a/doc/guides/nics/features/sssnic.ini b/doc/guides/nics/features/sssnic.ini
index 6d9786db7e..602839d301 100644
--- a/doc/guides/nics/features/sssnic.ini
+++ b/doc/guides/nics/features/sssnic.ini
@@ -4,6 +4,8 @@
; Refer to default.ini for the full list of available PMD features.
;
[Features]
+Unicast MAC filter = Y
+Multicast MAC filter = Y
Linux = Y
ARMv8 = Y
x86-64 = Y
diff --git a/drivers/net/sssnic/base/sssnic_api.c b/drivers/net/sssnic/base/sssnic_api.c
index bf0859cd63..76266dfbae 100644
--- a/drivers/net/sssnic/base/sssnic_api.c
+++ b/drivers/net/sssnic/base/sssnic_api.c
@@ -133,3 +133,177 @@ sssnic_capability_get(struct sssnic_hw *hw, struct sssnic_capability *capa)
return 0;
}
+
+int
+sssnic_mac_addr_get(struct sssnic_hw *hw, uint8_t *addr)
+{
+ int ret;
+ struct sssnic_mac_addr_cmd cmd;
+ struct sssnic_msg msg;
+ uint32_t cmd_len;
+ uint16_t func;
+
+ if (hw == NULL || addr == NULL)
+ return -EINVAL;
+
+ if (SSSNIC_FUNC_TYPE(hw) == SSSNIC_FUNC_TYPE_VF)
+ func = SSSNIC_PF_FUNC_IDX(hw);
+ else
+ func = SSSNIC_MPU_FUNC_IDX;
+
+ memset(&cmd, 0, sizeof(cmd));
+ cmd_len = sizeof(cmd);
+ cmd.function = SSSNIC_FUNC_IDX(hw);
+ sssnic_msg_init(&msg, (uint8_t *)&cmd, cmd_len, SSSNIC_GET_MAC_ADDR_CMD,
+ func, SSSNIC_LAN_MODULE, SSSNIC_MSG_TYPE_REQ);
+ ret = sssnic_mbox_send(hw, &msg, (uint8_t *)&cmd, &cmd_len, 0);
+ if (ret != 0) {
+ PMD_DRV_LOG(ERR, "Failed to send mbox message, ret=%d", ret);
+ return ret;
+ }
+
+ if (cmd_len == 0 || cmd.common.status != 0) {
+ PMD_DRV_LOG(ERR,
+ "Bad response to SSSNIC_GET_DEF_MAC_ADDR_CMD, len=%u, status=%u",
+ cmd_len, cmd.common.status);
+ return -EIO;
+ }
+
+ rte_memcpy(addr, cmd.addr, 6);
+
+ return 0;
+}
+
+int
+sssnic_mac_addr_update(struct sssnic_hw *hw, uint8_t *new, uint8_t *old)
+{
+ int ret;
+ struct sssnic_mac_addr_update_cmd cmd;
+ struct sssnic_msg msg;
+ uint32_t cmd_len;
+ uint16_t func;
+
+ if (hw == NULL || new == NULL || old == NULL)
+ return -EINVAL;
+
+ if (SSSNIC_FUNC_TYPE(hw) == SSSNIC_FUNC_TYPE_VF)
+ func = SSSNIC_PF_FUNC_IDX(hw);
+ else
+ func = SSSNIC_MPU_FUNC_IDX;
+
+ memset(&cmd, 0, sizeof(cmd));
+ cmd_len = sizeof(cmd);
+ cmd.function = SSSNIC_FUNC_IDX(hw);
+ rte_memcpy(cmd.new_addr, new, 6);
+ rte_memcpy(cmd.old_addr, old, 6);
+ sssnic_msg_init(&msg, (uint8_t *)&cmd, cmd_len,
+ SSSNIC_UPDATE_MAC_ADDR_CMD, func, SSSNIC_LAN_MODULE,
+ SSSNIC_MSG_TYPE_REQ);
+ ret = sssnic_mbox_send(hw, &msg, (uint8_t *)&cmd, &cmd_len, 0);
+ if (ret != 0) {
+ PMD_DRV_LOG(ERR, "Failed to send mbox message, ret=%d", ret);
+ return ret;
+ }
+
+ if (cmd_len == 0 || cmd.common.status != 0) {
+ if (cmd.common.status == SSSNIC_MAC_ADDR_CMD_STATUS_IGNORED) {
+ PMD_DRV_LOG(WARNING,
+ "MAC address operation is ignored");
+ return 0;
+ }
+ PMD_DRV_LOG(ERR,
+ "Bad response to SSSNIC_UPDATE_MAC_ADDR_CMD, len=%u, status=%u",
+ cmd_len, cmd.common.status);
+ return -EIO;
+ }
+
+ return 0;
+}
+
+int
+sssnic_mac_addr_add(struct sssnic_hw *hw, uint8_t *addr)
+{
+ int ret;
+ struct sssnic_mac_addr_cmd cmd;
+ struct sssnic_msg msg;
+ uint32_t cmd_len;
+ uint16_t func;
+
+ if (hw == NULL || addr == NULL)
+ return -EINVAL;
+
+ if (SSSNIC_FUNC_TYPE(hw) == SSSNIC_FUNC_TYPE_VF)
+ func = SSSNIC_PF_FUNC_IDX(hw);
+ else
+ func = SSSNIC_MPU_FUNC_IDX;
+
+ memset(&cmd, 0, sizeof(cmd));
+ cmd_len = sizeof(cmd);
+ cmd.function = SSSNIC_FUNC_IDX(hw);
+ rte_memcpy(cmd.addr, addr, 6);
+ sssnic_msg_init(&msg, (uint8_t *)&cmd, cmd_len, SSSNIC_ADD_MAC_ADDR_CMD,
+ func, SSSNIC_LAN_MODULE, SSSNIC_MSG_TYPE_REQ);
+ ret = sssnic_mbox_send(hw, &msg, (uint8_t *)&cmd, &cmd_len, 0);
+ if (ret != 0) {
+ PMD_DRV_LOG(ERR, "Failed to send mbox message, ret=%d", ret);
+ return ret;
+ }
+
+ if (cmd_len == 0 || cmd.common.status != 0) {
+ if (cmd.common.status == SSSNIC_MAC_ADDR_CMD_STATUS_IGNORED) {
+ PMD_DRV_LOG(WARNING,
+ "MAC address operation is ignored");
+ return 0;
+ }
+ PMD_DRV_LOG(ERR,
+ "Bad response to SSSNIC_ADD_MAC_ADDR_CMD, len=%u, status=%u",
+ cmd_len, cmd.common.status);
+ return -EIO;
+ }
+
+ return 0;
+}
+
+int
+sssnic_mac_addr_del(struct sssnic_hw *hw, uint8_t *addr)
+{
+ int ret;
+ struct sssnic_mac_addr_cmd cmd;
+ struct sssnic_msg msg;
+ uint32_t cmd_len;
+ uint16_t func;
+
+ if (hw == NULL || addr == NULL)
+ return -EINVAL;
+
+ if (SSSNIC_FUNC_TYPE(hw) == SSSNIC_FUNC_TYPE_VF)
+ func = SSSNIC_PF_FUNC_IDX(hw);
+ else
+ func = SSSNIC_MPU_FUNC_IDX;
+
+ memset(&cmd, 0, sizeof(cmd));
+ cmd_len = sizeof(cmd);
+ cmd.function = SSSNIC_FUNC_IDX(hw);
+ rte_memcpy(cmd.addr, addr, 6);
+ sssnic_msg_init(&msg, (uint8_t *)&cmd, cmd_len, SSSNIC_DEL_MAC_ADDR_CMD,
+ func, SSSNIC_LAN_MODULE, SSSNIC_MSG_TYPE_REQ);
+ ret = sssnic_mbox_send(hw, &msg, (uint8_t *)&cmd, &cmd_len, 0);
+ if (ret != 0) {
+ PMD_DRV_LOG(ERR, "Failed to send mbox message, ret=%d", ret);
+ return ret;
+ }
+
+ if (cmd_len == 0 || cmd.common.status != 0) {
+ if (cmd.common.status == SSSNIC_MAC_ADDR_CMD_STATUS_IGNORED) {
+ PMD_DRV_LOG(WARNING,
+ "MAC address operation is ignored");
+ return 0;
+ }
+ PMD_DRV_LOG(ERR,
+ "Bad response to SSSNIC_DEL_MAC_ADDR_CMD, len=%u, status=%u",
+ cmd_len, cmd.common.status);
+ return -EIO;
+ }
+
+ return 0;
+}
diff --git a/drivers/net/sssnic/base/sssnic_api.h b/drivers/net/sssnic/base/sssnic_api.h
index 8011cc8b0f..b985230595 100644
--- a/drivers/net/sssnic/base/sssnic_api.h
+++ b/drivers/net/sssnic/base/sssnic_api.h
@@ -27,5 +27,9 @@ int sssnic_msix_attr_get(struct sssnic_hw *hw, uint16_t msix_idx,
int sssnic_msix_attr_set(struct sssnic_hw *hw, uint16_t msix_idx,
struct sssnic_msix_attr *attr);
int sssnic_capability_get(struct sssnic_hw *hw, struct sssnic_capability *capa);
+int sssnic_mac_addr_get(struct sssnic_hw *hw, uint8_t *addr);
+int sssnic_mac_addr_update(struct sssnic_hw *hw, uint8_t *new, uint8_t *old);
+int sssnic_mac_addr_add(struct sssnic_hw *hw, uint8_t *addr);
+int sssnic_mac_addr_del(struct sssnic_hw *hw, uint8_t *addr);
#endif /* _SSSNIC_API_H_ */
diff --git a/drivers/net/sssnic/base/sssnic_cmd.h b/drivers/net/sssnic/base/sssnic_cmd.h
index 79192affbc..e70184866e 100644
--- a/drivers/net/sssnic/base/sssnic_cmd.h
+++ b/drivers/net/sssnic/base/sssnic_cmd.h
@@ -20,6 +20,14 @@ enum sssnic_mgmt_cmd_id {
#define SSSNIC_GET_CAPABILITY_CMD 0
+#define SSSNIC_MAC_ADDR_CMD_STATUS_IGNORED 0x4
+enum sssnic_mac_addr_cmd_id {
+ SSSNIC_GET_MAC_ADDR_CMD = 20,
+ SSSNIC_ADD_MAC_ADDR_CMD,
+ SSSNIC_DEL_MAC_ADDR_CMD,
+ SSSNIC_UPDATE_MAC_ADDR_CMD,
+};
+
struct sssnic_cmd_common {
uint8_t status;
uint8_t version;
@@ -125,4 +133,21 @@ struct sssnic_capability_get_cmd {
uint32_t resvd3[63];
};
+struct sssnic_mac_addr_cmd {
+ struct sssnic_cmd_common common;
+ uint16_t function;
+ uint16_t vlan;
+ uint16_t resvd;
+ uint8_t addr[6];
+};
+
+struct sssnic_mac_addr_update_cmd {
+ struct sssnic_cmd_common common;
+ uint16_t function;
+ uint16_t vlan;
+ uint16_t resvd0;
+ uint8_t old_addr[6];
+ uint16_t resvd1;
+ uint8_t new_addr[6];
+};
#endif /* _SSSNIC_CMD_H_ */
diff --git a/drivers/net/sssnic/base/sssnic_hw.h b/drivers/net/sssnic/base/sssnic_hw.h
index 5f20a9465d..f8fe2ac7e1 100644
--- a/drivers/net/sssnic/base/sssnic_hw.h
+++ b/drivers/net/sssnic/base/sssnic_hw.h
@@ -70,6 +70,7 @@ struct sssnic_hw {
#define SSSNIC_PHY_PORT(hw) ((hw)->phy_port)
#define SSSNIC_FUNC_TYPE(hw) ((hw)->attr.func_type)
#define SSSNIC_AF_FUNC_IDX(hw) ((hw)->attr.af_idx)
+#define SSSNIC_PF_FUNC_IDX(hw) ((hw)->attr.pf_idx)
enum sssnic_module {
SSSNIC_COMM_MODULE = 0,
diff --git a/drivers/net/sssnic/sssnic_ethdev.c b/drivers/net/sssnic/sssnic_ethdev.c
index 2d7ed7d60b..92a20649fc 100644
--- a/drivers/net/sssnic/sssnic_ethdev.c
+++ b/drivers/net/sssnic/sssnic_ethdev.c
@@ -7,6 +7,7 @@
#include "sssnic_log.h"
#include "base/sssnic_hw.h"
+#include "base/sssnic_api.h"
#include "sssnic_ethdev.h"
static int
@@ -63,6 +64,258 @@ sssnic_ethdev_infos_get(struct rte_eth_dev *ethdev,
return 0;
}
+static int
+sssnic_ethdev_mac_addr_set(struct rte_eth_dev *ethdev,
+ struct rte_ether_addr *mac_addr)
+{
+ int ret;
+ struct sssnic_netdev *netdev;
+ struct sssnic_hw *hw;
+ char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
+
+ netdev = SSSNIC_ETHDEV_PRIVATE(ethdev);
+ hw = SSSNIC_NETDEV_TO_HW(netdev);
+
+ rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, mac_addr);
+
+ ret = sssnic_mac_addr_update(hw, mac_addr->addr_bytes,
+ netdev->default_addr.addr_bytes);
+ if (ret != 0) {
+ PMD_DRV_LOG(ERR, "Failed to update default MAC address: %s",
+ mac_str);
+ return ret;
+ }
+ rte_ether_addr_copy(mac_addr, &netdev->default_addr);
+
+ PMD_DRV_LOG(INFO, "Updated default MAC address %s of port %u", mac_str,
+ ethdev->data->port_id);
+
+ return 0;
+}
+
+static void
+sssnic_ethdev_mac_addr_remove(struct rte_eth_dev *ethdev, uint32_t index)
+{
+ int ret;
+ struct sssnic_netdev *netdev;
+ struct sssnic_hw *hw;
+ struct rte_ether_addr *mac;
+ char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
+
+ netdev = SSSNIC_ETHDEV_PRIVATE(ethdev);
+ hw = SSSNIC_NETDEV_TO_HW(netdev);
+
+ mac = ðdev->data->mac_addrs[index];
+ ret = sssnic_mac_addr_del(hw, mac->addr_bytes);
+ if (ret != 0) {
+ rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, mac);
+ PMD_DRV_LOG(ERR, "Failed to delete MAC address %s", mac_str);
+ }
+}
+
+static int
+sssnic_ethdev_mac_addr_add(struct rte_eth_dev *ethdev,
+ struct rte_ether_addr *mac_addr, __rte_unused uint32_t index,
+ __rte_unused uint32_t vmdq)
+{
+ int ret;
+ struct sssnic_netdev *netdev;
+ struct sssnic_hw *hw;
+ char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
+
+ netdev = SSSNIC_ETHDEV_PRIVATE(ethdev);
+ hw = SSSNIC_NETDEV_TO_HW(netdev);
+
+ if (rte_is_multicast_ether_addr(mac_addr)) {
+ rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
+ mac_addr);
+ PMD_DRV_LOG(ERR,
+ "Invalid MAC address:%s, cannot be multicast address",
+ mac_str);
+ }
+
+ ret = sssnic_mac_addr_add(hw, mac_addr->addr_bytes);
+ if (ret != 0) {
+ rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
+ mac_addr);
+ PMD_DRV_LOG(ERR, "Failed to add MAC address %s", mac_str);
+ return ret;
+ }
+
+ return 0;
+}
+
+static void
+sssnic_ethdev_mcast_addrs_clean(struct rte_eth_dev *ethdev)
+{
+ int ret;
+ struct sssnic_netdev *netdev;
+ struct sssnic_hw *hw;
+ int i;
+
+ netdev = SSSNIC_ETHDEV_PRIVATE(ethdev);
+ hw = SSSNIC_NETDEV_TO_HW(netdev);
+
+ for (i = 0; i < SSSNIC_ETHDEV_MAX_NUM_MC_MAC; i++) {
+ if (rte_is_zero_ether_addr(&netdev->mcast_addrs[i]))
+ break;
+
+ ret = sssnic_mac_addr_del(hw,
+ netdev->mcast_addrs[i].addr_bytes);
+ if (ret != 0)
+ PMD_DRV_LOG(WARNING, "Failed to delete MAC address");
+
+ memset(&netdev->mcast_addrs[i], 0,
+ sizeof(struct rte_ether_addr));
+ }
+}
+
+static int
+sssnic_ethdev_set_mc_addr_list(struct rte_eth_dev *ethdev,
+ struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr)
+{
+ int ret;
+ struct sssnic_netdev *netdev;
+ struct sssnic_hw *hw;
+ char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
+ uint32_t i;
+
+ netdev = SSSNIC_ETHDEV_PRIVATE(ethdev);
+ hw = SSSNIC_NETDEV_TO_HW(netdev);
+
+ if (nb_mc_addr > SSSNIC_ETHDEV_MAX_NUM_MC_MAC) {
+ PMD_DRV_LOG(ERR,
+ "Failed to set mcast address list to port %u, excceds max number:%u",
+ ethdev->data->port_id, SSSNIC_ETHDEV_MAX_NUM_MC_MAC);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < nb_mc_addr; i++) {
+ if (!rte_is_multicast_ether_addr(&mc_addr_set[i])) {
+ rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
+ &mc_addr_set[i]);
+ PMD_DRV_LOG(ERR, "Invalid Multicast MAC address: %s",
+ mac_str);
+ return -EINVAL;
+ }
+ }
+
+ sssnic_ethdev_mcast_addrs_clean(ethdev);
+
+ for (i = 0; i < nb_mc_addr; i++) {
+ ret = sssnic_mac_addr_add(hw, mc_addr_set[i].addr_bytes);
+ if (ret != 0) {
+ sssnic_ethdev_mcast_addrs_clean(ethdev);
+ rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
+ &mc_addr_set[i]);
+ PMD_DRV_LOG(ERR,
+ "Failed to add Multicast MAC address: %s",
+ mac_str);
+ return ret;
+ }
+ rte_ether_addr_copy(&mc_addr_set[i], &netdev->mcast_addrs[i]);
+ }
+
+ return 0;
+}
+
+static int
+sssnic_ethdev_mac_addrs_init(struct rte_eth_dev *ethdev)
+{
+ int ret;
+ struct sssnic_netdev *netdev;
+ struct sssnic_hw *hw;
+ struct rte_ether_addr default_addr;
+ char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
+
+ PMD_INIT_FUNC_TRACE();
+
+ netdev = SSSNIC_ETHDEV_PRIVATE(ethdev);
+ hw = SSSNIC_NETDEV_TO_HW(netdev);
+
+ ethdev->data->mac_addrs = rte_zmalloc(NULL,
+ SSSNIC_ETHDEV_MAX_NUM_UC_MAC * sizeof(struct rte_ether_addr),
+ 0);
+ if (ethdev->data->mac_addrs == NULL) {
+ PMD_DRV_LOG(ERR,
+ "Failed to allocate memory to store %u mac addresses",
+ SSSNIC_ETHDEV_MAX_NUM_UC_MAC);
+ return -ENOMEM;
+ }
+
+ netdev->mcast_addrs = rte_zmalloc(NULL,
+ SSSNIC_ETHDEV_MAX_NUM_MC_MAC * sizeof(struct rte_ether_addr),
+ 0);
+ if (netdev->mcast_addrs == NULL) {
+ PMD_DRV_LOG(ERR,
+ "Failed to allocate memory to store %u mcast addresses",
+ SSSNIC_ETHDEV_MAX_NUM_MC_MAC);
+ ret = -ENOMEM;
+ goto alloc_mcast_addr_fail;
+ }
+
+ /* initialize default MAC address */
+ memset(&default_addr, 0, sizeof(default_addr));
+ ret = sssnic_mac_addr_get(hw, default_addr.addr_bytes);
+ if (ret != 0)
+ PMD_DRV_LOG(NOTICE,
+ "Could not get default MAC address, will use random address");
+
+ if (rte_is_zero_ether_addr(&default_addr))
+ rte_eth_random_addr(default_addr.addr_bytes);
+
+ rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, &default_addr);
+
+ ret = sssnic_mac_addr_add(hw, default_addr.addr_bytes);
+ if (ret != 0) {
+ PMD_DRV_LOG(ERR, "Failed to add default MAC address: %s",
+ mac_str);
+ goto add_ether_addr_fail;
+ }
+
+ rte_ether_addr_copy(&default_addr, ðdev->data->mac_addrs[0]);
+ rte_ether_addr_copy(&default_addr, &netdev->default_addr);
+
+ PMD_DRV_LOG(INFO, "Port %u default MAC address: %s",
+ ethdev->data->port_id, mac_str);
+
+ return 0;
+
+add_ether_addr_fail:
+ rte_free(netdev->mcast_addrs);
+ netdev->mcast_addrs = NULL;
+alloc_mcast_addr_fail:
+ rte_free(ethdev->data->mac_addrs);
+ ethdev->data->mac_addrs = NULL;
+ return ret;
+}
+
+static void
+sssnic_ethdev_mac_addrs_clean(struct rte_eth_dev *ethdev)
+{
+ int ret;
+ struct sssnic_netdev *netdev;
+ struct sssnic_hw *hw;
+ int i;
+
+ netdev = SSSNIC_ETHDEV_PRIVATE(ethdev);
+ hw = SSSNIC_NETDEV_TO_HW(netdev);
+
+ for (i = 0; i < SSSNIC_ETHDEV_MAX_NUM_UC_MAC; i++) {
+ if (rte_is_zero_ether_addr(ðdev->data->mac_addrs[i]))
+ continue;
+
+ ret = sssnic_mac_addr_del(hw,
+ ethdev->data->mac_addrs[i].addr_bytes);
+ if (ret != 0)
+ PMD_DRV_LOG(ERR,
+ "Failed to delete MAC address from port %u",
+ ethdev->data->port_id);
+ }
+
+ sssnic_ethdev_mcast_addrs_clean(ethdev);
+}
+
static int
sssnic_ethdev_configure(struct rte_eth_dev *ethdev)
{
@@ -80,6 +333,7 @@ sssnic_ethdev_release(struct rte_eth_dev *ethdev)
{
struct sssnic_hw *hw = SSSNIC_ETHDEV_TO_HW(ethdev);
+ sssnic_ethdev_mac_addrs_clean(ethdev);
sssnic_hw_shutdown(hw);
rte_free(hw);
}
@@ -87,6 +341,10 @@ sssnic_ethdev_release(struct rte_eth_dev *ethdev)
static const struct eth_dev_ops sssnic_ethdev_ops = {
.dev_configure = sssnic_ethdev_configure,
.dev_infos_get = sssnic_ethdev_infos_get,
+ .mac_addr_set = sssnic_ethdev_mac_addr_set,
+ .mac_addr_remove = sssnic_ethdev_mac_addr_remove,
+ .mac_addr_add = sssnic_ethdev_mac_addr_add,
+ .set_mc_addr_list = sssnic_ethdev_set_mc_addr_list,
};
static int
@@ -118,12 +376,22 @@ sssnic_ethdev_init(struct rte_eth_dev *ethdev)
return ret;
}
+ ret = sssnic_ethdev_mac_addrs_init(ethdev);
+ if (ret != 0) {
+ PMD_DRV_LOG(ERR, "Failed to initialize MAC addresses");
+ goto mac_addrs_init_fail;
+ }
+
netdev->max_num_rxq = SSSNIC_MAX_NUM_RXQ(hw);
netdev->max_num_txq = SSSNIC_MAX_NUM_TXQ(hw);
ethdev->dev_ops = &sssnic_ethdev_ops;
return 0;
+
+mac_addrs_init_fail:
+ sssnic_hw_shutdown(0);
+ return ret;
}
static int
@@ -140,7 +408,7 @@ sssnic_ethdev_uninit(struct rte_eth_dev *ethdev)
sssnic_ethdev_release(ethdev);
- return -EINVAL;
+ return 0;
}
static int
diff --git a/drivers/net/sssnic/sssnic_ethdev.h b/drivers/net/sssnic/sssnic_ethdev.h
index 70dd43d5c0..636b3fd04c 100644
--- a/drivers/net/sssnic/sssnic_ethdev.h
+++ b/drivers/net/sssnic/sssnic_ethdev.h
@@ -58,6 +58,8 @@
struct sssnic_netdev {
void *hw;
+ struct rte_ether_addr *mcast_addrs;
+ struct rte_ether_addr default_addr;
uint16_t max_num_txq;
uint16_t max_num_rxq;
};
--
2.27.0
next prev parent reply other threads:[~2023-09-04 4:58 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-04 4:56 [PATCH v5 00/32] Introduce sssnic PMD for 3SNIC's 9x0 serials Ethernet adapters wanry
2023-09-04 4:56 ` [PATCH v5 01/32] net/sssnic: add build and doc infrastructure wanry
2023-09-26 13:06 ` Ferruh Yigit
2023-09-04 4:56 ` [PATCH v5 02/32] net/sssnic: add log type and log macros wanry
2023-09-04 4:56 ` [PATCH v5 03/32] net/sssnic: support probe and remove wanry
2023-09-18 16:08 ` Stephen Hemminger
2023-09-19 2:00 ` Renyong Wan
2023-09-04 4:56 ` [PATCH v5 04/32] net/sssnic: initialize hardware base wanry
2023-09-18 2:28 ` Stephen Hemminger
2023-09-18 4:47 ` Renyong Wan
2023-09-04 4:56 ` [PATCH v5 05/32] net/sssnic: add event queue wanry
2023-09-04 4:56 ` [PATCH v5 06/32] net/sssnic/base: add message definition and utility wanry
2023-09-18 2:31 ` Stephen Hemminger
2023-09-18 5:08 ` Renyong Wan
2023-09-04 4:56 ` [PATCH v5 07/32] net/sssnic/base: add mailbox support wanry
2023-09-18 2:32 ` Stephen Hemminger
2023-09-18 5:10 ` Renyong Wan
2023-09-26 13:13 ` Ferruh Yigit
2023-09-04 4:56 ` [PATCH v5 08/32] net/sssnic/base: add work queue wanry
2023-09-18 2:33 ` Stephen Hemminger
2023-09-18 5:11 ` Renyong Wan
2023-09-04 4:56 ` [PATCH v5 09/32] net/sssnic/base: add control queue wanry
2023-09-18 2:36 ` Stephen Hemminger
2023-09-18 5:22 ` Renyong Wan
2023-09-04 4:56 ` [PATCH v5 10/32] net/sssnic: add dev configure and infos get wanry
2023-09-04 4:56 ` wanry [this message]
2023-09-26 13:07 ` [PATCH v5 11/32] net/sssnic: add dev MAC ops Ferruh Yigit
2023-09-04 4:56 ` [PATCH v5 12/32] net/sssnic: support dev link status wanry
2023-09-04 4:56 ` [PATCH v5 13/32] net/sssnic: support link status event wanry
2023-09-26 13:08 ` Ferruh Yigit
2023-09-04 4:56 ` [PATCH v5 14/32] net/sssnic: support Rx queue setup and release wanry
2023-09-04 4:56 ` [PATCH v5 15/32] net/sssnic: support Tx " wanry
2023-09-04 4:56 ` [PATCH v5 16/32] net/sssnic: support Rx queue start and stop wanry
2023-09-04 4:56 ` [PATCH v5 17/32] net/sssnic: support Tx " wanry
2023-09-04 4:56 ` [PATCH v5 18/32] net/sssnic: add Rx interrupt support wanry
2023-09-04 4:56 ` [PATCH v5 19/32] net/sssnic: support dev start and stop wanry
2023-09-26 13:09 ` Ferruh Yigit
2023-09-04 4:56 ` [PATCH v5 20/32] net/sssnic: support dev close and reset wanry
2023-09-26 13:09 ` Ferruh Yigit
2023-09-04 4:56 ` [PATCH v5 21/32] net/sssnic: add allmulticast and promiscuous ops wanry
2023-09-04 4:56 ` [PATCH v5 22/32] net/sssnic: add basic and extended stats ops wanry
2023-09-04 4:56 ` [PATCH v5 23/32] net/sssnic: support Rx packet burst wanry
2023-09-04 4:56 ` [PATCH v5 24/32] net/sssnic: support Tx " wanry
2023-09-26 13:10 ` Ferruh Yigit
2023-09-04 4:56 ` [PATCH v5 25/32] net/sssnic: add RSS support wanry
2023-09-04 4:56 ` [PATCH v5 26/32] net/sssnic: support dev MTU set wanry
2023-09-04 4:56 ` [PATCH v5 27/32] net/sssnic: support dev queue info get wanry
2023-09-04 4:56 ` [PATCH v5 28/32] net/sssnic: support dev firmware version get wanry
2023-09-04 4:56 ` [PATCH v5 29/32] net/sssnic: add dev flow control ops wanry
2023-09-26 13:12 ` Ferruh Yigit
2023-09-04 4:56 ` [PATCH v5 30/32] net/sssnic: support VLAN offload and filter wanry
2023-09-04 4:56 ` [PATCH v5 31/32] net/sssnic: add generic flow ops wanry
2023-09-04 4:56 ` [PATCH v5 32/32] net/sssnic: add VF dev support wanry
2023-09-26 13:11 ` Ferruh Yigit
2023-09-18 2:37 ` [PATCH v5 00/32] Introduce sssnic PMD for 3SNIC's 9x0 serials Ethernet adapters Stephen Hemminger
2023-09-18 3:23 ` Renyong Wan
2023-09-19 3:19 ` Stephen Hemminger
2023-09-19 5:18 ` Renyong Wan
2023-09-19 3:21 ` Stephen Hemminger
2023-09-19 5:18 ` Renyong Wan
2023-09-19 3:23 ` Stephen Hemminger
2023-09-19 5:19 ` Renyong Wan
2023-09-19 15:24 ` Stephen Hemminger
2023-09-26 13:13 ` Ferruh Yigit
2024-03-29 11:32 ` Ferruh Yigit
2024-07-31 17:32 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230904045658.238185-12-wanry@3snic.com \
--to=wanry@3snic.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=steven.song@3snic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).