}
int
-octeontx_bgx_port_mac_add(int port, uint8_t *mac_addr)
+octeontx_bgx_port_mac_add(int port, uint8_t *mac_addr, int index)
{
+ struct octeontx_mbox_bgx_port_mac_filter filter;
struct octeontx_mbox_hdr hdr;
- int resp = 0;
int len = 6;
- int res = 0;
hdr.coproc = OCTEONTX_BGX_COPROC;
hdr.msg = MBOX_BGX_PORT_ADD_MACADDR;
hdr.vfid = port;
- res = octeontx_mbox_send(&hdr, mac_addr, len, &resp, sizeof(int));
- if (res < 0)
- return -EACCES;
+ memcpy(filter.mac_addr, mac_addr, len);
+ filter.index = index;
+ len = sizeof(struct octeontx_mbox_bgx_port_mac_filter);
- return res;
+ return octeontx_mbox_send(&hdr, &filter, len, NULL, 0);
}
int
uint64_t rx_jabber_errors;
} octeontx_mbox_bgx_port_stats_t;
+struct octeontx_mbox_bgx_port_mac_filter {
+ uint8_t mac_addr[6];
+ int index;
+};
+
int octeontx_bgx_port_open(int port, octeontx_mbox_bgx_port_conf_t *conf);
int octeontx_bgx_port_close(int port);
int octeontx_bgx_port_start(int port);
int octeontx_bgx_port_link_status(int port);
int octeontx_bgx_port_promisc_set(int port, int en);
int octeontx_bgx_port_mac_set(int port, uint8_t *mac_addr);
-int octeontx_bgx_port_mac_add(int port, uint8_t *mac_addr);
+int octeontx_bgx_port_mac_add(int port, uint8_t *mac_addr, int index);
int octeontx_bgx_port_mac_del(int port, uint32_t index);
int octeontx_bgx_port_mac_entries_get(int port);
static int
octeontx_dev_mac_addr_add(struct rte_eth_dev *dev,
struct rte_ether_addr *mac_addr,
- __rte_unused uint32_t index,
+ uint32_t index,
__rte_unused uint32_t vmdq)
{
struct octeontx_nic *nic = octeontx_pmd_priv(dev);
int ret;
- ret = octeontx_bgx_port_mac_add(nic->port_id, mac_addr->addr_bytes);
+ ret = octeontx_bgx_port_mac_add(nic->port_id, mac_addr->addr_bytes,
+ index);
if (ret < 0) {
octeontx_log_err("failed to add MAC address filter on port %d",
nic->port_id);
struct rte_ether_addr *addr)
{
struct octeontx_nic *nic = octeontx_pmd_priv(dev);
+ uint8_t prom_mode = dev->data->promiscuous;
int ret;
+ dev->data->promiscuous = 0;
ret = octeontx_bgx_port_mac_set(nic->port_id, addr->addr_bytes);
- if (ret != 0)
+ if (ret == 0) {
+ /* Update same mac address to BGX CAM table */
+ ret = octeontx_bgx_port_mac_add(nic->port_id, addr->addr_bytes,
+ 0);
+ }
+ if (ret < 0) {
+ dev->data->promiscuous = prom_mode;
octeontx_log_err("failed to set MAC address on port %d",
- nic->port_id);
+ nic->port_id);
+ }
return ret;
}
/* Update port_id mac to eth_dev */
memcpy(data->mac_addrs, nic->mac_addr, RTE_ETHER_ADDR_LEN);
+ /* Update same mac address to BGX CAM table at index 0 */
+ octeontx_bgx_port_mac_add(nic->port_id, nic->mac_addr, 0);
+
PMD_INIT_LOG(DEBUG, "ethdev info: ");
PMD_INIT_LOG(DEBUG, "port %d, port_ena %d ochan %d num_ochan %d tx_q %d",
nic->port_id, nic->port_ena,