static void ingress_port_service_pool_stats(int statid, counter_operations_t type, bufmon_counter_info_t *counter) { int port, sp; opennsl_gport_t gport; opennsl_error_t rv = OPENNSL_E_NONE; opennsl_cosq_bst_profile_t profile; port = smap_get_int(&counter->counter_vendor_specific_info, "port", INVALID); INPUT_PARAM_VALIDATE(port); sp = smap_get_int(&counter->counter_vendor_specific_info, "service-pool", INVALID); INPUT_PARAM_VALIDATE(sp); rv = opennsl_port_gport_get(counter->hw_unit_id, port, &gport);; OPENNSL_RV_ERROR_CHECK(rv, " %d %d", port, gport); if (type == GET_COUNTER_VALUE) { rv = BCM_API_BST_STAT_GET(counter->hw_unit_id, gport, sp - 1, statid, 0, &counter->counter_value); } else if (type == SET_COUNTER_THRESHOLD && counter->trigger_threshold) { profile.byte = counter->trigger_threshold; rv = BCM_API_BST_PROFILE_SET(counter->hw_unit_id, gport, sp - 1, statid, &profile); } OPENNSL_RV_ERROR_CHECK(rv, " %d %d %d", gport, port, sp); }/* ingress_port_service_pool_stats */
static void egress_cpu_stats (int statid, counter_operations_t type, bufmon_counter_info_t *counter) { int queue; opennsl_error_t rv = OPENNSL_E_NONE; opennsl_gport_t gport; opennsl_cosq_bst_profile_t profile; queue = smap_get_int(&counter->counter_vendor_specific_info, "queue", INVALID); INPUT_PARAM_VALIDATE(queue); rv = opennsl_port_gport_get(counter->hw_unit_id, 0, &gport); if (type == GET_COUNTER_VALUE) { rv = BCM_API_BST_STAT_GET(counter->hw_unit_id, gport, queue - 1, statid, 0, &counter->counter_value); } else if (type == SET_COUNTER_THRESHOLD && counter->trigger_threshold) { profile.byte = counter->trigger_threshold; rv = BCM_API_BST_PROFILE_SET(counter->hw_unit_id, gport, queue - 1, statid, &profile); } OPENNSL_RV_ERROR_CHECK(rv, " %d", queue); }/* egress_cpu_stats */
BcmPort::BcmPort(BcmSwitch* hw, opennsl_port_t port, BcmPlatformPort* platformPort) : hw_(hw), port_(port), platformPort_(platformPort), unit_(hw->getUnit()) { // Obtain the gport handle from the port handle. int rv = opennsl_port_gport_get(unit_, port_, &gport_); bcmCheckError(rv, "Failed to get gport for BCM port ", port_); disablePause(); // Initialize our stats data structures auto statMap = fbData->getStatMap(); const auto expType = stats::AVG; outQueueLen_ = statMap->getLockAndStatItem(statName("out_queue_length"), &expType); auto histMap = fbData->getHistogramMap(); stats::ExportedHistogram pktLenHist(1, 0, kInPktLengthStats.size()); inPktLengths_ = histMap->getOrCreateUnlocked(statName("in_pkt_lengths"), &pktLenHist); outPktLengths_ = histMap->getOrCreateUnlocked(statName("out_pkt_lengths"), &pktLenHist); setConfiguredMaxSpeed(); VLOG(2) << "created BCM port:" << port_ << ", gport:" << gport_ << ", FBOSS PortID:" << platformPort_->getPortID(); }
BcmPort::BcmPort(BcmSwitch* hw, opennsl_port_t port, BcmPlatformPort* platformPort) : hw_(hw), port_(port), platformPort_(platformPort), unit_(hw->getUnit()) { // Obtain the gport handle from the port handle. int rv = opennsl_port_gport_get(unit_, port_, &gport_); bcmCheckError(rv, "Failed to get gport for BCM port ", port_); // Initialize our stats data structures reinitPortStats(); VLOG(2) << "created BCM port:" << port_ << ", gport:" << gport_ << ", FBOSS PortID:" << platformPort_->getPortID(); }