diff options
-rw-r--r-- | Documentation/networking/net_dim.txt | 36 |
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. | |||
92 | Part III: Registering a Network Device to DIM | 92 | Part III: Registering a Network Device to DIM |
93 | ============================================== | 93 | ============================================== |
94 | 94 | ||
95 | Net DIM API exposes the main function net_dim(struct net_dim *dim, | 95 | Net DIM API exposes the main function net_dim(struct dim *dim, |
96 | struct net_dim_sample end_sample). This function is the entry point to the Net | 96 | struct dim_sample end_sample). This function is the entry point to the Net |
97 | DIM algorithm and has to be called every time the driver would like to check if | 97 | DIM algorithm and has to be called every time the driver would like to check if |
98 | it should change interrupt moderation parameters. The driver should provide two | 98 | it should change interrupt moderation parameters. The driver should provide two |
99 | data structures: struct net_dim and struct net_dim_sample. Struct net_dim | 99 | data structures: struct dim and struct dim_sample. Struct dim |
100 | describes the state of DIM for a specific object (RX queue, TX queue, | 100 | describes the state of DIM for a specific object (RX queue, TX queue, |
101 | other queues, etc.). This includes the current selected profile, previous data | 101 | other queues, etc.). This includes the current selected profile, previous data |
102 | samples, the callback function provided by the driver and more. | 102 | samples, the callback function provided by the driver and more. |
103 | Struct net_dim_sample describes a data sample, which will be compared to the | 103 | Struct dim_sample describes a data sample, which will be compared to the |
104 | data sample stored in struct net_dim in order to decide on the algorithm's next | 104 | data sample stored in struct dim in order to decide on the algorithm's next |
105 | step. The sample should include bytes, packets and interrupts, measured by | 105 | step. The sample should include bytes, packets and interrupts, measured by |
106 | the driver. | 106 | the driver. |
107 | 107 | ||
@@ -110,9 +110,9 @@ main net_dim() function. The recommended method is to call net_dim() on each | |||
110 | interrupt. Since Net DIM has a built-in moderation and it might decide to skip | 110 | interrupt. Since Net DIM has a built-in moderation and it might decide to skip |
111 | iterations under certain conditions, there is no need to moderate the net_dim() | 111 | iterations under certain conditions, there is no need to moderate the net_dim() |
112 | calls as well. As mentioned above, the driver needs to provide an object of type | 112 | calls as well. As mentioned above, the driver needs to provide an object of type |
113 | struct net_dim to the net_dim() function call. It is advised for each entity | 113 | struct dim to the net_dim() function call. It is advised for each entity |
114 | using Net DIM to hold a struct net_dim as part of its data structure and use it | 114 | using Net DIM to hold a struct dim as part of its data structure and use it |
115 | as the main Net DIM API object. The struct net_dim_sample should hold the latest | 115 | as the main Net DIM API object. The struct dim_sample should hold the latest |
116 | bytes, packets and interrupts count. No need to perform any calculations, just | 116 | bytes, packets and interrupts count. No need to perform any calculations, just |
117 | include the raw data. | 117 | include 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 | ||
133 | my_driver.c: | 133 | my_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 */ |
138 | void my_driver_do_dim_work(struct work_struct *work) | 138 | void 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 | ... |