Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cli/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2622,7 +2622,12 @@ static int display_event_counters(struct switchtec_dev *dev, int stack,
if (strlen(buf) > 39)
strcpy(buf, "MANY");

printf("%-40s %10u\n", buf, counts[i]);
if (setups[i].type_mask & ALL_TLPS)
printf("%-40s %-8s %10u\n", buf,
setups[i].egress ? "EGRESS" : "INGRESS",
counts[i]);
else
printf("%-40s %-8s %10u\n", buf, "", counts[i]);
count++;
}

Expand Down
3 changes: 3 additions & 0 deletions inc/switchtec/pmon.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
#include <stdint.h>
#include <switchtec/switchtec.h>

#define SWITCHTEC_PMON_EVENT_EGRESS 0x80
#define SWITCHTEC_PMON_EVENT_INGRESS 0x00

#pragma pack(push, 1)

struct pmon_event_counter_setup {
Expand Down
13 changes: 9 additions & 4 deletions lib/pmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ int switchtec_evcntr_setup(struct switchtec_dev *dev, unsigned stack_id,
[0] = {
.mask = htole32((setup->type_mask << 8) |
(setup->port_mask & 0xFF)),
.ieg = setup->egress,
.ieg = (setup->egress ? SWITCHTEC_PMON_EVENT_EGRESS :
SWITCHTEC_PMON_EVENT_INGRESS) |
((setup->type_mask >> 24) & 0x7F),
.thresh = htole32(setup->threshold),
},
},
Expand Down Expand Up @@ -231,9 +233,12 @@ int switchtec_evcntr_get_setup(struct switchtec_dev *dev, unsigned stack_id,
return ret;

for (i = 0; i < nr_cntrs; i++) {
res[i].port_mask = le32toh(data[i].mask) & 0xFF;
res[i].type_mask = le32toh(data[i].mask) >> 8;
res[i].egress = data[i].ieg;
uint32_t m = le32toh(data[i].mask);

res[i].port_mask = m & 0xFF;
res[i].type_mask = ((m >> 8) & 0xFFFFFF) |
((data[i].ieg & 0x7F) << 24);
res[i].egress = (data[i].ieg >> 7) & 1;
res[i].threshold = le32toh(data[i].thresh);
}

Expand Down