#include "vnic_enet.h"
#include "enic.h"
-int enicpmd_logtype_init;
-int enicpmd_logtype_flow;
-
-#define ENICPMD_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
+int enic_pmd_logtype;
/*
* The set of PCI devices this driver supports
RTE_INIT(enicpmd_init_log)
{
- enicpmd_logtype_init = rte_log_register("pmd.net.enic.init");
- if (enicpmd_logtype_init >= 0)
- rte_log_set_level(enicpmd_logtype_init, RTE_LOG_NOTICE);
- enicpmd_logtype_flow = rte_log_register("pmd.net.enic.flow");
- if (enicpmd_logtype_flow >= 0)
- rte_log_set_level(enicpmd_logtype_flow, RTE_LOG_NOTICE);
+ enic_pmd_logtype = rte_log_register("pmd.net.enic");
+ if (enic_pmd_logtype >= 0)
+ rte_log_set_level(enic_pmd_logtype, RTE_LOG_NOTICE);
}
static int
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, addr);
- PMD_INIT_LOG(DEBUG, " %s address %s\n",
+ ENICPMD_LOG(DEBUG, " %s address %s\n",
add ? "add" : "remove", mac_str);
}
rte_is_broadcast_ether_addr(addr)) {
rte_ether_format_addr(mac_str,
RTE_ETHER_ADDR_FMT_SIZE, addr);
- PMD_INIT_LOG(ERR, " invalid multicast address %s\n",
+ ENICPMD_LOG(ERR, " invalid multicast address %s\n",
mac_str);
return -EINVAL;
}
/* Flush all if requested */
if (nb_mc_addr == 0 || mc_addr_set == NULL) {
- PMD_INIT_LOG(DEBUG, " flush multicast addresses\n");
+ ENICPMD_LOG(DEBUG, " flush multicast addresses\n");
for (i = 0; i < enic->mc_count; i++) {
addr = &enic->mc_addrs[i];
debug_log_add_del_addr(addr, false);
}
if (nb_mc_addr > ENIC_MULTICAST_PERFECT_FILTERS) {
- PMD_INIT_LOG(ERR, " too many multicast addresses: max=%d\n",
+ ENICPMD_LOG(ERR, " too many multicast addresses: max=%d\n",
ENIC_MULTICAST_PERFECT_FILTERS);
return -ENOSPC;
}
if (tnl->prot_type != RTE_TUNNEL_TYPE_VXLAN)
return -ENOTSUP;
if (!enic->overlay_offload) {
- PMD_INIT_LOG(DEBUG, " vxlan (overlay offload) is not "
+ ENICPMD_LOG(DEBUG, " vxlan (overlay offload) is not "
"supported\n");
return -ENOTSUP;
}
if (vnic_dev_overlay_offload_cfg(enic->vdev,
OVERLAY_CFG_VXLAN_PORT_UPDATE,
port)) {
- PMD_INIT_LOG(DEBUG, " failed to update vxlan port\n");
+ ENICPMD_LOG(DEBUG, " failed to update vxlan port\n");
return -EINVAL;
}
- PMD_INIT_LOG(DEBUG, " updated vxlan port to %u\n", port);
+ ENICPMD_LOG(DEBUG, " updated vxlan port to %u\n", port);
enic->vxlan_port = port;
return 0;
}
* number replaces it.
*/
if (tnl->udp_port == enic->vxlan_port || tnl->udp_port == 0) {
- PMD_INIT_LOG(DEBUG, " %u is already configured or invalid\n",
+ ENICPMD_LOG(DEBUG, " %u is already configured or invalid\n",
tnl->udp_port);
return -EINVAL;
}
* which is tied to inner RSS and TSO.
*/
if (tnl->udp_port != enic->vxlan_port) {
- PMD_INIT_LOG(DEBUG, " %u is not a configured vxlan port\n",
+ ENICPMD_LOG(DEBUG, " %u is not a configured vxlan port\n",
tnl->udp_port);
return -EINVAL;
}
#include "vnic_dev.h"
#include "vnic_nic.h"
-#define FLOW_TRACE() \
- rte_log(RTE_LOG_DEBUG, enicpmd_logtype_flow, \
- "%s()\n", __func__)
-#define FLOW_LOG(level, fmt, args...) \
- rte_log(RTE_LOG_ ## level, enicpmd_logtype_flow, \
- fmt "\n", ##args)
-
/*
* Common arguments passed to copy_item functions. Use this structure
* so we can easily add new arguments.
.dst_addr = 0xffffffff,
};
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
if (!mask)
mask = &rte_flow_item_ipv4_mask;
/* This is an exact match filter, both fields must be set */
if (!spec || !spec->hdr.src_addr || !spec->hdr.dst_addr) {
- FLOW_LOG(ERR, "IPv4 exact match src/dst addr");
+ ENICPMD_LOG(ERR, "IPv4 exact match src/dst addr");
return ENOTSUP;
}
/* check that the suppied mask exactly matches capabilty */
if (!mask_exact_match((const u8 *)&supported_mask,
(const u8 *)item->mask, sizeof(*mask))) {
- FLOW_LOG(ERR, "IPv4 exact match mask");
+ ENICPMD_LOG(ERR, "IPv4 exact match mask");
return ENOTSUP;
}
.dst_port = 0xffff,
};
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
if (!mask)
mask = &rte_flow_item_udp_mask;
/* This is an exact match filter, both ports must be set */
if (!spec || !spec->hdr.src_port || !spec->hdr.dst_port) {
- FLOW_LOG(ERR, "UDP exact match src/dst addr");
+ ENICPMD_LOG(ERR, "UDP exact match src/dst addr");
return ENOTSUP;
}
/* check that the suppied mask exactly matches capabilty */
if (!mask_exact_match((const u8 *)&supported_mask,
(const u8 *)item->mask, sizeof(*mask))) {
- FLOW_LOG(ERR, "UDP exact match mask");
+ ENICPMD_LOG(ERR, "UDP exact match mask");
return ENOTSUP;
}
.dst_port = 0xffff,
};
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
if (!mask)
mask = &rte_flow_item_tcp_mask;
/* This is an exact match filter, both ports must be set */
if (!spec || !spec->hdr.src_port || !spec->hdr.dst_port) {
- FLOW_LOG(ERR, "TCPIPv4 exact match src/dst addr");
+ ENICPMD_LOG(ERR, "TCPIPv4 exact match src/dst addr");
return ENOTSUP;
}
/* check that the suppied mask exactly matches capabilty */
if (!mask_exact_match((const u8 *)&supported_mask,
(const u8 *)item->mask, sizeof(*mask))) {
- FLOW_LOG(ERR, "TCP exact match mask");
+ ENICPMD_LOG(ERR, "TCP exact match mask");
return ENOTSUP;
}
const void *mask = arg->item->mask;
uint8_t *off = arg->inner_ofst;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
if (!mask)
mask = &rte_flow_item_eth_mask;
arg->l2_proto_off = *off + offsetof(struct rte_ether_hdr, ether_type);
uint8_t *off = arg->inner_ofst;
uint8_t eth_type_off;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
if (!mask)
mask = &rte_flow_item_vlan_mask;
/* Append vlan header to L5 and set ether type = TPID */
const void *mask = arg->item->mask;
uint8_t *off = arg->inner_ofst;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
if (!mask)
mask = &rte_flow_item_ipv4_mask;
/* Append ipv4 header to L5 and set ether type = ipv4 */
const void *mask = arg->item->mask;
uint8_t *off = arg->inner_ofst;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
if (!mask)
mask = &rte_flow_item_ipv6_mask;
/* Append ipv6 header to L5 and set ether type = ipv6 */
const void *mask = arg->item->mask;
uint8_t *off = arg->inner_ofst;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
if (!mask)
mask = &rte_flow_item_udp_mask;
/* Append udp header to L5 and set ip proto = udp */
const void *mask = arg->item->mask;
uint8_t *off = arg->inner_ofst;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
if (!mask)
mask = &rte_flow_item_tcp_mask;
/* Append tcp header to L5 and set ip proto = tcp */
const struct rte_flow_item_eth *mask = item->mask;
struct filter_generic_1 *gp = &enic_filter->u.generic_1;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
/* Match all if no spec */
if (!spec)
struct rte_ether_hdr *eth_mask;
struct rte_ether_hdr *eth_val;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
/* Match all if no spec */
if (!spec)
const struct rte_flow_item_ipv4 *mask = item->mask;
struct filter_generic_1 *gp = &enic_filter->u.generic_1;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
/* Match IPv4 */
gp->mask_flags |= FILTER_GENERIC_1_IPV4;
const struct rte_flow_item_ipv6 *mask = item->mask;
struct filter_generic_1 *gp = &enic_filter->u.generic_1;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
/* Match IPv6 */
gp->mask_flags |= FILTER_GENERIC_1_IPV6;
const struct rte_flow_item_udp *mask = item->mask;
struct filter_generic_1 *gp = &enic_filter->u.generic_1;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
/* Match UDP */
gp->mask_flags |= FILTER_GENERIC_1_UDP;
const struct rte_flow_item_tcp *mask = item->mask;
struct filter_generic_1 *gp = &enic_filter->u.generic_1;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
/* Match TCP */
gp->mask_flags |= FILTER_GENERIC_1_TCP;
uint8_t *ip_proto_mask = NULL;
uint8_t *ip_proto = NULL;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
/*
* The NIC filter API has no flags for "match sctp", so explicitly set
struct filter_generic_1 *gp = &enic_filter->u.generic_1;
struct rte_udp_hdr *udp;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
/*
* The NIC filter API has no flags for "match vxlan". Set UDP port to
const struct rte_flow_item_raw *mask = item->mask;
struct filter_generic_1 *gp = &enic_filter->u.generic_1;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
/* Cannot be used for inner packet */
if (*inner_ofst)
{
enum rte_flow_item_type const *allowed_items = item_info->prev_items;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
for (; *allowed_items != RTE_FLOW_ITEM_TYPE_END; allowed_items++) {
if (prev_item == *allowed_items)
if (!(inner_ofst > 0 && enic->vxlan))
return;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
vxlan = sizeof(struct rte_vxlan_hdr);
memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct rte_udp_hdr),
gp->layer[FILTER_GENERIC_1_L5].mask, vxlan);
enic_copy_item_fn *copy_fn;
u8 is_first_item = 1;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
prev_item = 0;
enum { FATE = 1, };
uint32_t overlap = 0;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
if (actions->type == RTE_FLOW_ACTION_TYPE_VOID)
uint32_t overlap = 0;
bool passthru = false;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
switch (actions->type) {
enic_dump_actions(const struct filter_action_v2 *ea)
{
if (ea->type == FILTER_ACTION_RQ_STEERING) {
- FLOW_LOG(INFO, "Action(V1), queue: %u\n", ea->rq_idx);
+ ENICPMD_LOG(INFO, "Action(V1), queue: %u\n", ea->rq_idx);
} else if (ea->type == FILTER_ACTION_V2) {
- FLOW_LOG(INFO, "Actions(V2)\n");
+ ENICPMD_LOG(INFO, "Actions(V2)\n");
if (ea->flags & FILTER_ACTION_RQ_STEERING_FLAG)
- FLOW_LOG(INFO, "\tqueue: %u\n",
+ ENICPMD_LOG(INFO, "\tqueue: %u\n",
enic_sop_rq_idx_to_rte_idx(ea->rq_idx));
if (ea->flags & FILTER_ACTION_FILTER_ID_FLAG)
- FLOW_LOG(INFO, "\tfilter_id: %u\n", ea->filter_id);
+ ENICPMD_LOG(INFO, "\tfilter_id: %u\n", ea->filter_id);
}
}
switch (filt->type) {
case FILTER_IPV4_5TUPLE:
- FLOW_LOG(INFO, "FILTER_IPV4_5TUPLE\n");
+ ENICPMD_LOG(INFO, "FILTER_IPV4_5TUPLE\n");
break;
case FILTER_USNIC_IP:
case FILTER_DPDK_1:
/* FIXME: this should be a loop */
gp = &filt->u.generic_1;
- FLOW_LOG(INFO, "Filter: vlan: 0x%04x, mask: 0x%04x\n",
+ ENICPMD_LOG(INFO, "Filter: vlan: 0x%04x, mask: 0x%04x\n",
gp->val_vlan, gp->mask_vlan);
if (gp->mask_flags & FILTER_GENERIC_1_IPV4)
? "ipfrag(y)" : "ipfrag(n)");
else
sprintf(ipfrag, "%s ", "ipfrag(x)");
- FLOW_LOG(INFO, "\tFlags: %s%s%s%s%s%s%s%s\n", ip4, ip6, udp,
+ ENICPMD_LOG(INFO, "\tFlags: %s%s%s%s%s%s%s%s\n", ip4, ip6, udp,
tcp, tcpudp, ip4csum, l4csum, ipfrag);
for (i = 0; i < FILTER_GENERIC_1_NUM_LAYERS; i++) {
bp += 2;
}
*bp = '\0';
- FLOW_LOG(INFO, "\tL%u mask: %s\n", i + 2, buf);
+ ENICPMD_LOG(INFO, "\tL%u mask: %s\n", i + 2, buf);
bp = buf;
for (j = 0; j <= mbyte; j++) {
sprintf(bp, "%02x",
bp += 2;
}
*bp = '\0';
- FLOW_LOG(INFO, "\tL%u val: %s\n", i + 2, buf);
+ ENICPMD_LOG(INFO, "\tL%u val: %s\n", i + 2, buf);
}
break;
default:
- FLOW_LOG(INFO, "FILTER UNKNOWN\n");
+ ENICPMD_LOG(INFO, "FILTER UNKNOWN\n");
break;
}
}
const struct enic_action_cap *enic_action_cap;
const struct rte_flow_action *action;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
memset(enic_filter, 0, sizeof(*enic_filter));
memset(enic_action, 0, sizeof(*enic_action));
int err;
u16 entry;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
flow = rte_calloc(__func__, 1, sizeof(*flow), 0);
if (!flow) {
u16 filter_id;
int err;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
filter_id = flow->enic_filter_id;
err = vnic_dev_classifier(enic->vdev, CLSF_DEL, &filter_id, NULL, NULL);
struct filter_action_v2 enic_action;
int ret;
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
ret = enic_flow_parse(dev, attrs, pattern, actions, error,
&enic_filter, &enic_action);
struct rte_flow *flow;
struct enic *enic = pmd_priv(dev);
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
ret = enic_flow_parse(dev, attrs, pattern, actions, error, &enic_filter,
&enic_action);
{
struct enic *enic = pmd_priv(dev);
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
enic_flow_del_filter(enic, flow, error);
LIST_REMOVE(flow, next);
struct rte_flow *flow;
struct enic *enic = pmd_priv(dev);
- FLOW_TRACE();
+ ENICPMD_FUNC_TRACE();
while (!LIST_EMPTY(&enic->flows)) {