Lines Matching refs:nic
75 list_for_each_entry(struct nic_info, nic, &gnic_list, list) { in find_nic_by_name()
76 if (nic->mode != mode) in find_nic_by_name()
79 if (strcasecmp(nic->name, n) == 0) in find_nic_by_name()
80 return nic; in find_nic_by_name()
108 query_wifi_bitrate(const struct nic_info *nic, uint64_t *bitrate) in query_wifi_bitrate() argument
117 strcpy(req.ifr_name, nic->name); in query_wifi_bitrate()
124 fprintf(stderr, "Unable to create socket for %s\n", nic->name); in query_wifi_bitrate()
129 fprintf(stderr, "Error performing SIOCGIWSTATS on %s\n", nic->name); in query_wifi_bitrate()
139 query_nic_rssi(const struct nic_info *nic, uint64_t *leveldBm) in query_nic_rssi() argument
148 strcpy(req.ifr_name, nic->name); in query_nic_rssi()
153 if (nic->mode != NIC_RSSI_DBM) in query_nic_rssi()
158 fprintf(stderr, "Unable to create socket for %s\n", nic->name); in query_nic_rssi()
164 fprintf(stderr, "Error performing SIOCGIWSTATS on %s\n", nic->name); in query_nic_rssi()
180 struct nic_info *nic = gr->query_data; in query_nic_load() local
183 if (nic->last_time) { in query_nic_load()
184 if (nic->last_time + gr->pane->period <= now) { in query_nic_load()
185 switch (nic->mode) { in query_nic_load()
190 get_nic_bytes(nic->throughput_filename, &bytes); in query_nic_load()
192 ((bytes - nic->last_nic_bytes) / 1000000) * 8; in query_nic_load()
194 float speedMbps = nic->speedMbps; in query_nic_load()
209 nic->last_nic_bytes = bytes; in query_nic_load()
215 query_nic_rssi(nic, &leveldBm); in query_nic_load()
221 nic->last_time = now; in query_nic_load()
226 switch (nic->mode) { in query_nic_load()
229 get_nic_bytes(nic->throughput_filename, &nic->last_nic_bytes); in query_nic_load()
235 nic->last_time = now; in query_nic_load()
250 struct nic_info *nic; in hud_nic_graph_install() local
256 nic = find_nic_by_name(nic_name, mode); in hud_nic_graph_install()
257 if (!nic) in hud_nic_graph_install()
264 nic->mode = mode; in hud_nic_graph_install()
265 if (nic->mode == NIC_DIRECTION_RX) { in hud_nic_graph_install()
266 snprintf(gr->name, sizeof(gr->name), "%s-rx-%lldMbps", nic->name, in hud_nic_graph_install()
267 nic->speedMbps); in hud_nic_graph_install()
269 else if (nic->mode == NIC_DIRECTION_TX) { in hud_nic_graph_install()
270 snprintf(gr->name, sizeof(gr->name), "%s-tx-%lldMbps", nic->name, in hud_nic_graph_install()
271 nic->speedMbps); in hud_nic_graph_install()
273 else if (nic->mode == NIC_RSSI_DBM) in hud_nic_graph_install()
274 snprintf(gr->name, sizeof(gr->name), "%s-rssi", nic->name); in hud_nic_graph_install()
278 gr->query_data = nic; in hud_nic_graph_install()
300 query_nic_bitrate(struct nic_info *nic, const char *dirbase) in query_nic_bitrate() argument
309 query_wifi_bitrate(nic, &nic->speedMbps); in query_nic_bitrate()
310 nic->speedMbps /= 1000000; in query_nic_bitrate()
315 get_file_value(fn, &nic->speedMbps); in query_nic_bitrate()
330 struct nic_info *nic; in hud_get_num_nics() local
368 nic = CALLOC_STRUCT(nic_info); in hud_get_num_nics()
369 strcpy(nic->name, dp->d_name); in hud_get_num_nics()
370 snprintf(nic->throughput_filename, sizeof(nic->throughput_filename), in hud_get_num_nics()
372 nic->mode = NIC_DIRECTION_RX; in hud_get_num_nics()
373 nic->is_wireless = is_wireless; in hud_get_num_nics()
374 query_nic_bitrate(nic, basename); in hud_get_num_nics()
376 list_addtail(&nic->list, &gnic_list); in hud_get_num_nics()
380 nic = CALLOC_STRUCT(nic_info); in hud_get_num_nics()
381 strcpy(nic->name, dp->d_name); in hud_get_num_nics()
382 snprintf(nic->throughput_filename, in hud_get_num_nics()
383 sizeof(nic->throughput_filename), in hud_get_num_nics()
385 nic->mode = NIC_DIRECTION_TX; in hud_get_num_nics()
386 nic->is_wireless = is_wireless; in hud_get_num_nics()
388 query_nic_bitrate(nic, basename); in hud_get_num_nics()
390 list_addtail(&nic->list, &gnic_list); in hud_get_num_nics()
393 if (nic->is_wireless) { in hud_get_num_nics()
395 nic = CALLOC_STRUCT(nic_info); in hud_get_num_nics()
396 strcpy(nic->name, dp->d_name); in hud_get_num_nics()
397 snprintf(nic->throughput_filename, in hud_get_num_nics()
398 sizeof(nic->throughput_filename), in hud_get_num_nics()
400 nic->mode = NIC_RSSI_DBM; in hud_get_num_nics()
402 query_nic_bitrate(nic, basename); in hud_get_num_nics()
404 list_addtail(&nic->list, &gnic_list); in hud_get_num_nics()
411 list_for_each_entry(struct nic_info, nic, &gnic_list, list) { in hud_get_num_nics()
414 nic->mode == NIC_DIRECTION_RX ? "rx" : in hud_get_num_nics()
415 nic->mode == NIC_DIRECTION_TX ? "tx" : in hud_get_num_nics()
416 nic->mode == NIC_RSSI_DBM ? "rssi" : "undefined", nic->name); in hud_get_num_nics()