Changes in uspace/srv/net/ethip/ethip_nic.c [1038a9c:3e6a98c5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/ethip/ethip_nic.c
r1038a9c r3e6a98c5 37 37 #include <adt/list.h> 38 38 #include <async.h> 39 #include < bool.h>39 #include <stdbool.h> 40 40 #include <errno.h> 41 41 #include <fibril_synch.h> … … 68 68 rc = loc_category_get_id("nic", &iplink_cat, IPC_FLAG_BLOCKING); 69 69 if (rc != EOK) { 70 log_msg(L VL_ERROR, "Failed resolving category 'nic'.");70 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed resolving category 'nic'."); 71 71 fibril_mutex_unlock(ðip_discovery_lock); 72 72 return ENOENT; … … 75 75 rc = loc_category_get_svcs(iplink_cat, &svcs, &count); 76 76 if (rc != EOK) { 77 log_msg(L VL_ERROR, "Failed getting list of IP links.");77 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting list of IP links."); 78 78 fibril_mutex_unlock(ðip_discovery_lock); 79 79 return EIO; … … 93 93 94 94 if (!already_known) { 95 log_msg(L VL_DEBUG, "Found NIC '%lu'",95 log_msg(LOG_DEFAULT, LVL_DEBUG, "Found NIC '%lu'", 96 96 (unsigned long) svcs[i]); 97 97 rc = ethip_nic_open(svcs[i]); 98 98 if (rc != EOK) 99 log_msg(L VL_ERROR, "Could not open NIC.");99 log_msg(LOG_DEFAULT, LVL_ERROR, "Could not open NIC."); 100 100 } 101 101 } … … 110 110 111 111 if (nic == NULL) { 112 log_msg(L VL_ERROR, "Failed allocating NIC structure. "112 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating NIC structure. " 113 113 "Out of memory."); 114 114 return NULL; … … 126 126 127 127 if (laddr == NULL) { 128 log_msg(L VL_ERROR, "Failed allocating NIC address structure. "128 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating NIC address structure. " 129 129 "Out of memory."); 130 130 return NULL; … … 153 153 nic_address_t nic_address; 154 154 155 log_msg(L VL_DEBUG, "ethip_nic_open()");155 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_open()"); 156 156 ethip_nic_t *nic = ethip_nic_new(); 157 157 if (nic == NULL) … … 160 160 int rc = loc_service_get_name(sid, &nic->svc_name); 161 161 if (rc != EOK) { 162 log_msg(L VL_ERROR, "Failed getting service name.");162 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting service name."); 163 163 goto error; 164 164 } … … 166 166 nic->sess = loc_service_connect(EXCHANGE_SERIALIZE, sid, 0); 167 167 if (nic->sess == NULL) { 168 log_msg(L VL_ERROR, "Failed connecting '%s'", nic->svc_name);168 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed connecting '%s'", nic->svc_name); 169 169 goto error; 170 170 } … … 174 174 rc = nic_callback_create(nic->sess, ethip_nic_cb_conn, nic); 175 175 if (rc != EOK) { 176 log_msg(L VL_ERROR, "Failed creating callback connection "176 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed creating callback connection " 177 177 "from '%s'", nic->svc_name); 178 178 goto error; 179 179 } 180 180 181 log_msg(L VL_DEBUG, "Opened NIC '%s'", nic->svc_name);181 log_msg(LOG_DEFAULT, LVL_DEBUG, "Opened NIC '%s'", nic->svc_name); 182 182 list_append(&nic->nic_list, ðip_nic_list); 183 183 in_list = true; … … 189 189 rc = nic_get_address(nic->sess, &nic_address); 190 190 if (rc != EOK) { 191 log_msg(L VL_ERROR, "Error getting MAC address of NIC '%s'.",191 log_msg(LOG_DEFAULT, LVL_ERROR, "Error getting MAC address of NIC '%s'.", 192 192 nic->svc_name); 193 193 goto error; … … 198 198 rc = nic_set_state(nic->sess, NIC_STATE_ACTIVE); 199 199 if (rc != EOK) { 200 log_msg(L VL_ERROR, "Error activating NIC '%s'.",200 log_msg(LOG_DEFAULT, LVL_ERROR, "Error activating NIC '%s'.", 201 201 nic->svc_name); 202 202 goto error; 203 203 } 204 204 205 log_msg(L VL_DEBUG, "Initialized IP link service, MAC = 0x%" PRIx64,205 log_msg(LOG_DEFAULT, LVL_DEBUG, "Initialized IP link service, MAC = 0x%" PRIx64, 206 206 nic->mac_addr.addr); 207 207 … … 225 225 ipc_call_t *call) 226 226 { 227 log_msg(L VL_DEBUG, "ethip_nic_addr_changed()");227 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_changed()"); 228 228 async_answer_0(callid, ENOTSUP); 229 229 } … … 236 236 size_t size; 237 237 238 log_msg(L VL_DEBUG, "ethip_nic_received() nic=%p", nic);238 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_received() nic=%p", nic); 239 239 240 240 rc = async_data_write_accept(&data, false, 0, 0, 0, &size); 241 241 if (rc != EOK) { 242 log_msg(L VL_DEBUG, "data_write_accept() failed");242 log_msg(LOG_DEFAULT, LVL_DEBUG, "data_write_accept() failed"); 243 243 return; 244 244 } 245 245 246 log_msg(L VL_DEBUG, "Ethernet PDU contents (%zu bytes)",246 log_msg(LOG_DEFAULT, LVL_DEBUG, "Ethernet PDU contents (%zu bytes)", 247 247 size); 248 248 249 log_msg(L VL_DEBUG, "call ethip_received");249 log_msg(LOG_DEFAULT, LVL_DEBUG, "call ethip_received"); 250 250 rc = ethip_received(&nic->iplink, data, size); 251 log_msg(L VL_DEBUG, "free data");251 log_msg(LOG_DEFAULT, LVL_DEBUG, "free data"); 252 252 free(data); 253 253 254 log_msg(L VL_DEBUG, "ethip_nic_received() done, rc=%d", rc);254 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_received() done, rc=%d", rc); 255 255 async_answer_0(callid, rc); 256 256 } … … 259 259 ipc_call_t *call) 260 260 { 261 log_msg(L VL_DEBUG, "ethip_nic_device_state()");261 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_device_state()"); 262 262 async_answer_0(callid, ENOTSUP); 263 263 } … … 267 267 ethip_nic_t *nic = (ethip_nic_t *)arg; 268 268 269 log_msg(L VL_DEBUG, "ethnip_nic_cb_conn()");269 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethnip_nic_cb_conn()"); 270 270 271 271 while (true) { … … 298 298 int rc = loc_register_cat_change_cb(ethip_nic_cat_change_cb); 299 299 if (rc != EOK) { 300 log_msg(L VL_ERROR, "Failed registering callback for NIC "300 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback for NIC " 301 301 "discovery (%d).", rc); 302 302 return rc; … … 308 308 ethip_nic_t *ethip_nic_find_by_iplink_sid(service_id_t iplink_sid) 309 309 { 310 log_msg(L VL_DEBUG, "ethip_nic_find_by_iplink_sid(%u)",310 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_find_by_iplink_sid(%u)", 311 311 (unsigned) iplink_sid); 312 312 313 313 list_foreach(ethip_nic_list, link) { 314 log_msg(L VL_DEBUG, "ethip_nic_find_by_iplink_sid - element");314 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_find_by_iplink_sid - element"); 315 315 ethip_nic_t *nic = list_get_instance(link, ethip_nic_t, 316 316 nic_list); 317 317 318 318 if (nic->iplink_sid == iplink_sid) { 319 log_msg(L VL_DEBUG, "ethip_nic_find_by_iplink_sid - found %p", nic);319 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_find_by_iplink_sid - found %p", nic); 320 320 return nic; 321 321 } 322 322 } 323 323 324 log_msg(L VL_DEBUG, "ethip_nic_find_by_iplink_sid - not found");324 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_find_by_iplink_sid - not found"); 325 325 return NULL; 326 326 } … … 329 329 { 330 330 int rc; 331 log_msg(L VL_DEBUG, "ethip_nic_send(size=%zu)", size);331 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_send(size=%zu)", size); 332 332 rc = nic_send_frame(nic->sess, data, size); 333 log_msg(L VL_DEBUG, "nic_send_frame -> %d", rc);333 log_msg(LOG_DEFAULT, LVL_DEBUG, "nic_send_frame -> %d", rc); 334 334 return rc; 335 335 } … … 339 339 ethip_link_addr_t *laddr; 340 340 341 log_msg(L VL_DEBUG, "ethip_nic_addr_add()");341 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_add()"); 342 342 laddr = ethip_nic_addr_new(addr); 343 343 if (laddr == NULL) … … 352 352 ethip_link_addr_t *laddr; 353 353 354 log_msg(L VL_DEBUG, "ethip_nic_addr_remove()");354 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_remove()"); 355 355 356 356 laddr = ethip_nic_addr_find(nic, addr); … … 366 366 iplink_srv_addr_t *addr) 367 367 { 368 log_msg(L VL_DEBUG, "ethip_nic_addr_find()");368 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_find()"); 369 369 370 370 list_foreach(nic->addr_list, link) {
Note:
See TracChangeset
for help on using the changeset viewer.