#include <npi_fflp.h>
#include <nxge_defs.h>
#include <nxge_fflp.h>
#include <nxge_flow.h>
#include <nxge_impl.h>
#include <nxge_common.h>
int nxge_tcam_class_enable = 0;
int nxge_tcam_lookup_enable = 0;
int nxge_flow_dist_enable = NXGE_CLASS_FLOW_USE_DST_PORT |
NXGE_CLASS_FLOW_USE_SRC_PORT | NXGE_CLASS_FLOW_USE_IPDST |
NXGE_CLASS_FLOW_USE_IPSRC | NXGE_CLASS_FLOW_USE_PROTO |
NXGE_CLASS_FLOW_USE_PORTNUM;
int nxge_tcp4_class = NXGE_CLASS_FLOW_USE_DST_PORT |
NXGE_CLASS_FLOW_USE_SRC_PORT | NXGE_CLASS_FLOW_USE_IPDST |
NXGE_CLASS_FLOW_USE_IPSRC | NXGE_CLASS_FLOW_USE_PROTO |
NXGE_CLASS_FLOW_USE_PORTNUM;
int nxge_udp4_class = NXGE_CLASS_FLOW_USE_DST_PORT |
NXGE_CLASS_FLOW_USE_SRC_PORT | NXGE_CLASS_FLOW_USE_IPDST |
NXGE_CLASS_FLOW_USE_IPSRC | NXGE_CLASS_FLOW_USE_PROTO |
NXGE_CLASS_FLOW_USE_PORTNUM;
int nxge_ah4_class = NXGE_CLASS_FLOW_USE_DST_PORT |
NXGE_CLASS_FLOW_USE_SRC_PORT | NXGE_CLASS_FLOW_USE_IPDST |
NXGE_CLASS_FLOW_USE_IPSRC | NXGE_CLASS_FLOW_USE_PROTO |
NXGE_CLASS_FLOW_USE_PORTNUM;
int nxge_sctp4_class = NXGE_CLASS_FLOW_USE_DST_PORT |
NXGE_CLASS_FLOW_USE_SRC_PORT | NXGE_CLASS_FLOW_USE_IPDST |
NXGE_CLASS_FLOW_USE_IPSRC | NXGE_CLASS_FLOW_USE_PROTO |
NXGE_CLASS_FLOW_USE_PORTNUM;
int nxge_tcp6_class = NXGE_CLASS_FLOW_USE_DST_PORT |
NXGE_CLASS_FLOW_USE_SRC_PORT | NXGE_CLASS_FLOW_USE_IPDST |
NXGE_CLASS_FLOW_USE_IPSRC | NXGE_CLASS_FLOW_USE_PROTO |
NXGE_CLASS_FLOW_USE_PORTNUM;
int nxge_udp6_class = NXGE_CLASS_FLOW_USE_DST_PORT |
NXGE_CLASS_FLOW_USE_SRC_PORT | NXGE_CLASS_FLOW_USE_IPDST |
NXGE_CLASS_FLOW_USE_IPSRC | NXGE_CLASS_FLOW_USE_PROTO |
NXGE_CLASS_FLOW_USE_PORTNUM;
int nxge_ah6_class = NXGE_CLASS_FLOW_USE_DST_PORT |
NXGE_CLASS_FLOW_USE_SRC_PORT | NXGE_CLASS_FLOW_USE_IPDST |
NXGE_CLASS_FLOW_USE_IPSRC | NXGE_CLASS_FLOW_USE_PROTO |
NXGE_CLASS_FLOW_USE_PORTNUM;
int nxge_sctp6_class = NXGE_CLASS_FLOW_USE_DST_PORT |
NXGE_CLASS_FLOW_USE_SRC_PORT | NXGE_CLASS_FLOW_USE_IPDST |
NXGE_CLASS_FLOW_USE_IPSRC | NXGE_CLASS_FLOW_USE_PROTO |
NXGE_CLASS_FLOW_USE_PORTNUM;
uint32_t nxge_fflp_init_h1 = 0xffffffff;
uint32_t nxge_fflp_init_h2 = 0xffff;
uint64_t class_quick_config_distribute[NXGE_CLASS_CONFIG_PARAMS] = {
0xffffffffULL,
0xffffULL,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
NXGE_CLASS_FLOW_GEN_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER
};
uint64_t class_quick_config_web_server[NXGE_CLASS_CONFIG_PARAMS] = {
0xffffffffULL,
0xffffULL,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
NXGE_CLASS_FLOW_WEB_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER,
NXGE_CLASS_FLOW_GEN_SERVER
};
nxge_status_t
nxge_classify_init(p_nxge_t nxgep)
{
nxge_status_t status = NXGE_OK;
status = nxge_classify_init_sw(nxgep);
if (status != NXGE_OK)
return (status);
status = nxge_set_hw_classify_config(nxgep);
if (status != NXGE_OK)
return (status);
status = nxge_classify_init_hw(nxgep);
if (status != NXGE_OK)
return (status);
return (NXGE_OK);
}
nxge_status_t
nxge_classify_uninit(p_nxge_t nxgep)
{
nxge_status_t status = NXGE_OK;
status = nxge_classify_exit_sw(nxgep);
if (status != NXGE_OK) {
return (status);
}
return (NXGE_OK);
}
uint64_t
nxge_classify_get_cfg_value(p_nxge_t nxgep, uint8_t cfg_type, uint8_t cfg_param)
{
uint64_t cfg_value;
if (cfg_param >= NXGE_CLASS_CONFIG_PARAMS)
return (-1);
switch (cfg_type) {
case CFG_L3_WEB:
cfg_value = class_quick_config_web_server[cfg_param];
break;
case CFG_L3_DISTRIBUTE:
default:
cfg_value = class_quick_config_distribute[cfg_param];
break;
}
return (cfg_value);
}
nxge_status_t
nxge_set_hw_classify_config(p_nxge_t nxgep)
{
p_nxge_dma_pt_cfg_t p_all_cfgp;
p_nxge_hw_pt_cfg_t p_cfgp;
NXGE_DEBUG_MSG((nxgep, OBP_CTL, "==> nxge_get_hw_classify_config"));
p_all_cfgp = (p_nxge_dma_pt_cfg_t)&nxgep->pt_config;
p_cfgp = (p_nxge_hw_pt_cfg_t)&p_all_cfgp->hw_config;
nxgep->class_config.mac_rdcgrp = p_cfgp->def_mac_rxdma_grpid;
nxgep->class_config.mcast_rdcgrp = p_cfgp->def_mac_rxdma_grpid;
NXGE_DEBUG_MSG((nxgep, OBP_CTL, "<== nxge_get_hw_classify_config"));
return (NXGE_OK);
}