aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/networking/net_dim.txt36
1 files changed, 18 insertions, 18 deletions
diff --git a/Documentation/networking/net_dim.txt b/Documentation/networking/net_dim.txt
index 9cb31c5e2dcd..9bdb7d5a3ba3 100644
--- a/Documentation/networking/net_dim.txt
+++ b/Documentation/networking/net_dim.txt
@@ -92,16 +92,16 @@ under some conditions.
92Part III: Registering a Network Device to DIM 92Part III: Registering a Network Device to DIM
93============================================== 93==============================================
94 94
95Net DIM API exposes the main function net_dim(struct net_dim *dim, 95Net DIM API exposes the main function net_dim(struct dim *dim,
96struct net_dim_sample end_sample). This function is the entry point to the Net 96struct dim_sample end_sample). This function is the entry point to the Net
97DIM algorithm and has to be called every time the driver would like to check if 97DIM algorithm and has to be called every time the driver would like to check if
98it should change interrupt moderation parameters. The driver should provide two 98it should change interrupt moderation parameters. The driver should provide two
99data structures: struct net_dim and struct net_dim_sample. Struct net_dim 99data structures: struct dim and struct dim_sample. Struct dim
100describes the state of DIM for a specific object (RX queue, TX queue, 100describes the state of DIM for a specific object (RX queue, TX queue,
101other queues, etc.). This includes the current selected profile, previous data 101other queues, etc.). This includes the current selected profile, previous data
102samples, the callback function provided by the driver and more. 102samples, the callback function provided by the driver and more.
103Struct net_dim_sample describes a data sample, which will be compared to the 103Struct dim_sample describes a data sample, which will be compared to the
104data sample stored in struct net_dim in order to decide on the algorithm's next 104data sample stored in struct dim in order to decide on the algorithm's next
105step. The sample should include bytes, packets and interrupts, measured by 105step. The sample should include bytes, packets and interrupts, measured by
106the driver. 106the driver.
107 107
@@ -110,9 +110,9 @@ main net_dim() function. The recommended method is to call net_dim() on each
110interrupt. Since Net DIM has a built-in moderation and it might decide to skip 110interrupt. Since Net DIM has a built-in moderation and it might decide to skip
111iterations under certain conditions, there is no need to moderate the net_dim() 111iterations under certain conditions, there is no need to moderate the net_dim()
112calls as well. As mentioned above, the driver needs to provide an object of type 112calls as well. As mentioned above, the driver needs to provide an object of type
113struct net_dim to the net_dim() function call. It is advised for each entity 113struct dim to the net_dim() function call. It is advised for each entity
114using Net DIM to hold a struct net_dim as part of its data structure and use it 114using Net DIM to hold a struct dim as part of its data structure and use it
115as the main Net DIM API object. The struct net_dim_sample should hold the latest 115as the main Net DIM API object. The struct dim_sample should hold the latest
116bytes, packets and interrupts count. No need to perform any calculations, just 116bytes, packets and interrupts count. No need to perform any calculations, just
117include the raw data. 117include the raw data.
118 118
@@ -132,19 +132,19 @@ usage is not complete but it should make the outline of the usage clear.
132 132
133my_driver.c: 133my_driver.c:
134 134
135#include <linux/net_dim.h> 135#include <linux/dim.h>
136 136
137/* Callback for net DIM to schedule on a decision to change moderation */ 137/* Callback for net DIM to schedule on a decision to change moderation */
138void my_driver_do_dim_work(struct work_struct *work) 138void my_driver_do_dim_work(struct work_struct *work)
139{ 139{
140 /* Get struct net_dim from struct work_struct */ 140 /* Get struct dim from struct work_struct */
141 struct net_dim *dim = container_of(work, struct net_dim, 141 struct dim *dim = container_of(work, struct dim,
142 work); 142 work);
143 /* Do interrupt moderation related stuff */ 143 /* Do interrupt moderation related stuff */
144 ... 144 ...
145 145
146 /* Signal net DIM work is done and it should move to next iteration */ 146 /* Signal net DIM work is done and it should move to next iteration */
147 dim->state = NET_DIM_START_MEASURE; 147 dim->state = DIM_START_MEASURE;
148} 148}
149 149
150/* My driver's interrupt handler */ 150/* My driver's interrupt handler */
@@ -152,13 +152,13 @@ int my_driver_handle_interrupt(struct my_driver_entity *my_entity, ...)
152{ 152{
153 ... 153 ...
154 /* A struct to hold current measured data */ 154 /* A struct to hold current measured data */
155 struct net_dim_sample dim_sample; 155 struct dim_sample dim_sample;
156 ... 156 ...
157 /* Initiate data sample struct with current data */ 157 /* Initiate data sample struct with current data */
158 net_dim_sample(my_entity->events, 158 dim_update_sample(my_entity->events,
159 my_entity->packets, 159 my_entity->packets,
160 my_entity->bytes, 160 my_entity->bytes,
161 &dim_sample); 161 &dim_sample);
162 /* Call net DIM */ 162 /* Call net DIM */
163 net_dim(&my_entity->dim, dim_sample); 163 net_dim(&my_entity->dim, dim_sample);
164 ... 164 ...