Commit bbf0c6cd authored by 's avatar

disable_dsm=1 in mapi.conf now disables even DSM initialization checks.

Fix for invalid DAG's gpp_base -- disables pkt drop counting.



git-svn-id: file:///home/svn/mapi/trunk@1237 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 6e702771
......@@ -388,7 +388,7 @@ mapidrv_proc_loop (int devid)
int err;
struct timeval maxwait;
struct timeval poll;
int dag_ports;
// int dag_ports;
if ((err=pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL)) != 0) {
ERROR_CMD(fprintf(stderr, "pthread_setcanceltype failed (%s) [%s:%d]\n",strerror(err),__FILE__,__LINE__));
......@@ -406,7 +406,7 @@ mapidrv_proc_loop (int devid)
poll.tv_usec = DAGPOLLINT;
dag_set_stream_poll(i->dagfd, i->dagstream, MINREADSIZE, &maxwait, &poll);
dag_ports = (*((u_int32_t *)(i->gpp_base+0x00)) >> 6) & 0x03;
// dag_ports = (*((u_int32_t *)(i->gpp_base+0x00)) >> 6) & 0x03;
while (1)
{
......@@ -416,11 +416,13 @@ mapidrv_proc_loop (int devid)
bottom = top - process_pkts ( bottom, diff,i);
/* Measure packet loss from DAG device */
if (*((u_int32_t *)(i->gpp_base+0x04)) == 0xffffffff) {
i->hwinfo.pkt_drop = *((volatile u_int32_t *)(i->gpp_base + (i->dagstream+1)*0x20 + 0x04));
}
else {
i->hwinfo.pkt_drop = *((volatile u_int32_t *)(i->gpp_base+0x0024));
if (i->gpp_base) {
if (*((u_int32_t *)(i->gpp_base+0x04)) == 0xffffffff) {
i->hwinfo.pkt_drop = *((volatile u_int32_t *)(i->gpp_base + (i->dagstream+1)*0x20 + 0x04));
}
else {
i->hwinfo.pkt_drop = *((volatile u_int32_t *)(i->gpp_base+0x0024));
}
}
}
......@@ -614,6 +616,7 @@ mapidrv_create_flow (int devid, int fd, char **devtype)
di->portcnt = 0;
di->counters = NULL;
di->dsm_filter_count = -1;
di->is_dsm_filtering = 0;
/* Gets a reference to the card, its root component and
* the number of ports on the card.
......@@ -625,7 +628,7 @@ mapidrv_create_flow (int devid, int fd, char **devtype)
di->portcnt = dag_component_get_subcomponent_count_of_type(di->root, kComponentPort);
/* We demand sane port range. */
if ((di->portcnt < 1) || (di->portcnt > 0xFFFF))
di->portcnt = 0;
di->portcnt = 0;
/* Room for global counters, two is the number of statistics collected:
* for packets and for bytes. */
......@@ -637,42 +640,36 @@ mapidrv_create_flow (int devid, int fd, char **devtype)
}
/* DSM */
di->is_dsm_filtering = dagdsm_is_dsm_supported(i->dagfd);
switch (di->is_dsm_filtering) {
case 1:
if (pc_load(CONFDIR "/" CONF_FILE)) {
char *disable_dsm = pc_get_param(pc_get_category("dag"), "disable_dsm");
char *binpath = pc_get_param(pc_get_category("dag"), "dsm_loader_bin");
if (disable_dsm && *disable_dsm && !strcmp(disable_dsm, "1")) {
di->is_dsm_filtering = 0;
DEBUG_CMD(printf("DAG: Data Stream Management (DSM) supported by hardware, but disabled in configuration file %s. [%s:%d]\n", CONF_FILE, __FILE__,__LINE__));
} else if (!binpath || !*binpath || (access(binpath, X_OK) != 0)) {
di->is_dsm_filtering = 0;
DEBUG_CMD(printf("DAG: Data Stream Management (DSM) supported by hardware, but disabled due to bad setting of parameter dsm_loader_bin in %s. [%s:%d]\n", CONF_FILE, __FILE__,__LINE__));
}
pc_close();
} else {
di->is_dsm_filtering = 0;
DEBUG_CMD(printf("Error opening configuration file %s, disabling DAG DSM. [%s:%d]\n", CONF_FILE, __FILE__,__LINE__));
}
if (di->is_dsm_filtering) {
/* It seems that there are 8 hw filters for all DSM DAGs. */
di->dsm_filter_count = 8;
DEBUG_CMD(printf("DAG: Data Stream Management (DSM) supported and will be used for BPF_FILTER functions. [%s:%d]\n",__FILE__,__LINE__));
}
break;
case 0:
DEBUG_CMD(printf("DAG: Data Stream Management (DSM) unavailable, wrong firmware loaded. [%s:%d]\n",__FILE__,__LINE__));
break;
default:
di->is_dsm_filtering = 0;
DEBUG_CMD(printf("DAG: Data Stream Management (DSM) unavailable, error calling dagdsm_is_dsm_supported(), code: %d [%s:%d]\n",
dagdsm_get_last_error(),__FILE__,__LINE__));
}
if (pc_load(CONFDIR "/" CONF_FILE)) {
char *disable_dsm = pc_get_param(pc_get_category("dag"), "disable_dsm");
if (!disable_dsm || !*disable_dsm || strcmp(disable_dsm, "1")) {
char *binpath = pc_get_param(pc_get_category("dag"), "dsm_loader_bin");
if (binpath && *binpath && (access(binpath, X_OK) == 0)) {
di->is_dsm_filtering = dagdsm_is_dsm_supported(i->dagfd);
switch (di->is_dsm_filtering) {
case 1:
/* It seems that there are 8 hw filters for all DSM DAGs. */
di->dsm_filter_count = 8;
DEBUG_CMD(printf("DAG: Data Stream Management (DSM) supported and will be used for BPF_FILTER functions. [%s:%d]\n",__FILE__,__LINE__));
break;
case 0:
DEBUG_CMD(printf("DAG: Data Stream Management (DSM) unavailable, wrong firmware loaded. [%s:%d]\n",__FILE__,__LINE__));
break;
default:
di->is_dsm_filtering = 0;
DEBUG_CMD(printf("DAG: Data Stream Management (DSM) unavailable, error calling dagdsm_is_dsm_supported(), code: %d [%s:%d]\n",
dagdsm_get_last_error(),__FILE__,__LINE__));
}
} else DEBUG_CMD(printf("DAG: Data Stream Management (DSM) disabled due to bad setting of parameter dsm_loader_bin in %s. [%s:%d]\n", CONF_FILE, __FILE__,__LINE__));
} else DEBUG_CMD(printf("DAG: Data Stream Management (DSM) disabled in configuration file %s. [%s:%d]\n", CONF_FILE, __FILE__,__LINE__));
pc_close();
} else DEBUG_CMD(printf("Error opening configuration file %s, disabling DAG DSM. [%s:%d]\n", CONF_FILE, __FILE__,__LINE__));
i->hwinfo.adapterinfo = di;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment