Skip to content

Commit 6d18659

Browse files
p-shah256facebook-github-bot
authored andcommitted
Expose XDP counters via Thrift API
Summary: Expose the newly added XDP-level statistics counters through Katran's Thrift API This builds on D82544156 which added the underlying BPF counters (`XDP_TOTAL_CNTR`, `XDP_TX_CNTR`, `XDP_DROP_CNTR`, `XDP_PASS_CNTR`) by providing the necessary Thrift service methods Reviewed By: lima1756, nikhildl12 Differential Revision: D82561662 fbshipit-source-id: e5f69786a642fa0db0b7b40584c31ef1cf6ae77e
1 parent 2975e7f commit 6d18659

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

katran/lib/KatranLb.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,22 @@ lb_stats KatranLb::getLruStats() {
19481948
return getLbStats(config_.maxVips + kLruCntrOffset);
19491949
}
19501950

1951+
lb_stats KatranLb::getXdpTotalStats() {
1952+
return getLbStats(config_.maxVips + kXdpTotalOffset);
1953+
}
1954+
1955+
lb_stats KatranLb::getXdpTxStats() {
1956+
return getLbStats(config_.maxVips + kXdpTxOffset);
1957+
}
1958+
1959+
lb_stats KatranLb::getXdpDropStats() {
1960+
return getLbStats(config_.maxVips + kXdpDropOffset);
1961+
}
1962+
1963+
lb_stats KatranLb::getXdpPassStats() {
1964+
return getLbStats(config_.maxVips + kXdpPassOffset);
1965+
}
1966+
19511967
lb_stats KatranLb::getLruMissStats() {
19521968
return getLbStats(config_.maxVips + kLruMissOffset);
19531969
}

katran/lib/KatranLb.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ constexpr uint32_t kIcmpPtbV6Offset = 12;
6969
constexpr uint32_t kIcmpPtbV4Offset = 13;
7070
constexpr uint32_t kXPopDecapSuccessfulOffset = 14;
7171
constexpr uint32_t kUdpFlowMigrationInvalidationOffset = 15;
72+
constexpr uint32_t kXdpTotalOffset = 16;
73+
constexpr uint32_t kXdpTxOffset = 17;
74+
constexpr uint32_t kXdpDropOffset = 18;
75+
constexpr uint32_t kXdpPassOffset = 19;
7276

7377
/**
7478
* LRU map related constants
@@ -525,6 +529,38 @@ class KatranLb {
525529
*/
526530
lb_stats getLruStats();
527531

532+
/**
533+
* @return struct lb_stats w/ statistics
534+
* for packets + bytes "touched" by lb
535+
*
536+
* helper function which returns total amount
537+
*/
538+
lb_stats getXdpTotalStats();
539+
540+
/**
541+
* @return struct lb_stats w/ statistics
542+
* for packets + bytes forwarded to vip backends
543+
*
544+
* helper function which returns total amount
545+
*/
546+
lb_stats getXdpTxStats();
547+
548+
/**
549+
* @return struct lb_stats w/ statistics
550+
* for packets + bytes dropped by lb
551+
*
552+
* helper function which returns total amount
553+
*/
554+
lb_stats getXdpDropStats();
555+
556+
/**
557+
* @return struct lb_stats w/ statistics
558+
* for packets + bytes passed up to the kernel
559+
*
560+
* helper function which returns total amount
561+
*/
562+
lb_stats getXdpPassStats();
563+
528564
/**
529565
* @return struct lb_stats w/ statistic of the reasons for lru misses
530566
*

0 commit comments

Comments
 (0)