Network Chip Sampling via Counter Overflow Flag
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The existing Netflow technology's counter operations, such as Read+Modify+Write (RMW), are time-consuming and reduce the forwarding performance of network chips due to the superposition of multiple sampling services, leading to an over-large access bandwidth between the network chip and the counter.
Innovation Solution
A sampling method where the network chip performs an X-addition operation on a counter index upon message reception, reading a return value that includes an Overflow Flag (OF), and judges whether it needs to perform sampling based on pre-set values, reducing unnecessary sampling and thus the access bandwidth.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If the network chip performs traditional Read+Modify+Write (RMW) operations on counters for sampling, then sampling functionality is achieved, but the operation is time-consuming and reduces forwarding performance
Solution Approach 1:
The counter access operation is segmented into two independent parts: (1) The network chip performs X-addition operation on counter index and reads the return value (including OF and new counter index) in one step; (2) The sampling decision is made independently based on the OF value. This segmentation eliminates the traditional RMW operation bottleneck and improves forwarding performance while maintaining sampling accuracy.
Solution Approach 2:
The counter value is pre-calculated by performing X-addition operation before the sampling decision is made. The return value including OF and new counter index is prepared in advance, allowing the network chip to make sampling decisions without time-consuming RMW operations during the forwarding path, thus improving forwarding performance.
2Adaptability or versatility
If multiple sampling services (port sampling, message type sampling, flow sampling) are superposed together, then comprehensive sampling coverage is achieved, but the access bandwidth between network chip and counter becomes over-large
Solution Approach 1:
Multiple sampling services (port sampling, message type sampling, flow sampling) are merged into a unified counter access mechanism. The network chip performs a single X-addition operation and reads a single return value that can serve multiple sampling purposes, reducing the total access bandwidth while maintaining comprehensive sampling coverage through the OF value interpretation.
3Reliability
If the network chip performs sampling based on traditional counter methods, then sampling is performed, but unnecessary sampling operations increase access bandwidth
Solution Approach 1:
The counter return value structure is designed to be self-sufficient, containing both the Overflow Flag (OF) and the new counter index in one read operation. The network chip can independently determine whether sampling is needed by checking the OF value without additional counter accesses, making the system self-service and reducing unnecessary sampling operations that would consume access bandwidth.
Data Source
Figure 1~2
Figure 3
Figure 4
AI summary
Disclosed are a sampling method and a network chip. The method includes: when it is determined that a network chip needs to perform sampling, the network chip performing an X-addition operation on a counter index of a counter upon reception of a message, and reading a return value of the counter, herein the return value includes an value of an Overflow Flag (OF) and a counter index after the X-addition operation is performed, and herein X is a pre-set value, and the value of the OF includes: a first pre-set value or a second pre-set value, the first pre-set value indicates that the counter overflows after the X-addition operation is performed, and the second pre-set value indicates that the counter does not overflow after the X-addition operation is performed; the network chip judging whether the value of the OF is the first pre-set value; and if the value of the OF is the first pre-set value, the network chip performing the sampling.