Changes in uspace/srv/net/nil/eth/eth.c [9cd8165:8d7ec69d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/nil/eth/eth.c
r9cd8165 r8d7ec69d 173 173 void *arg); 174 174 175 static int eth_device_state( eth_device_t *device, sysarg_t state)175 static int eth_device_state(nic_device_id_t device_id, sysarg_t state) 176 176 { 177 177 int index; … … 183 183 proto = eth_protos_get_index(ð_globals.protos, index); 184 184 if ((proto) && (proto->sess)) { 185 il_device_state_msg(proto->sess, device ->device_id,186 state,proto->service);185 il_device_state_msg(proto->sess, device_id, state, 186 proto->service); 187 187 } 188 188 } … … 347 347 } 348 348 349 rc = nic_callback_create(device->sess, eth_nic_cb_connection, device); 349 rc = nic_callback_create(device->sess, device_id, 350 eth_nic_cb_connection, NULL); 350 351 if (rc != EOK) { 351 352 fibril_rwlock_write_unlock(ð_globals.devices_lock); … … 824 825 } 825 826 826 static int eth_received( eth_device_t *device)827 static int eth_received(nic_device_id_t device_id) 827 828 { 828 829 void *data; … … 844 845 free(data); 845 846 846 return nil_received_msg_local(device ->device_id, packet);847 } 848 849 static int eth_addr_changed( eth_device_t *device)847 return nil_received_msg_local(device_id, packet); 848 } 849 850 static int eth_addr_changed(nic_device_id_t device_id) 850 851 { 851 852 nic_address_t address; … … 865 866 866 867 fibril_rwlock_write_lock(ð_globals.devices_lock); 867 868 printf("Device %d changing address from " PRIMAC " to " PRIMAC "\n", 869 device->device_id, ARGSMAC(device->addr.address), 870 ARGSMAC(address.address)); 871 memcpy(&device->addr, &address, sizeof (nic_address_t)); 872 fibril_rwlock_write_unlock(ð_globals.devices_lock); 873 874 /* Notify all upper layer modules */ 875 fibril_rwlock_read_lock(ð_globals.protos_lock); 876 int index; 877 for (index = 0; index < eth_protos_count(ð_globals.protos); index++) { 878 eth_proto_t *proto = eth_protos_get_index(ð_globals.protos, index); 879 if (proto->sess != NULL) { 880 il_addr_changed_msg(proto->sess, device->device_id, 881 ETH_ADDR, address.address); 882 } 883 } 884 885 fibril_rwlock_read_unlock(ð_globals.protos_lock); 886 return EOK; 868 /* An existing device? */ 869 eth_device_t *device = eth_devices_find(ð_globals.devices, device_id); 870 if (device) { 871 printf("Device %d changing address from " PRIMAC " to " PRIMAC "\n", 872 device_id, ARGSMAC(device->addr.address), ARGSMAC(address.address)); 873 memcpy(&device->addr, &address, sizeof (nic_address_t)); 874 fibril_rwlock_write_unlock(ð_globals.devices_lock); 875 876 /* Notify all upper layer modules */ 877 fibril_rwlock_read_lock(ð_globals.protos_lock); 878 int index; 879 for (index = 0; index < eth_protos_count(ð_globals.protos); index++) { 880 eth_proto_t *proto = eth_protos_get_index(ð_globals.protos, index); 881 if (proto->sess != NULL) { 882 il_addr_changed_msg(proto->sess, device->device_id, 883 ETH_ADDR, address.address); 884 } 885 } 886 887 fibril_rwlock_read_unlock(ð_globals.protos_lock); 888 return EOK; 889 } else { 890 return ENOENT; 891 } 887 892 } 888 893 … … 957 962 static void eth_nic_cb_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 958 963 { 959 eth_device_t *device = (eth_device_t *)arg;960 964 int rc; 961 965 … … 971 975 switch (IPC_GET_IMETHOD(call)) { 972 976 case NIC_EV_DEVICE_STATE: 973 rc = eth_device_state(device, IPC_GET_ARG1(call)); 977 rc = eth_device_state(IPC_GET_ARG1(call), 978 IPC_GET_ARG2(call)); 974 979 async_answer_0(callid, (sysarg_t) rc); 975 980 break; 976 981 case NIC_EV_RECEIVED: 977 rc = eth_received( device);982 rc = eth_received(IPC_GET_ARG1(call)); 978 983 async_answer_0(callid, (sysarg_t) rc); 979 984 break; 980 985 case NIC_EV_ADDR_CHANGED: 981 rc = eth_addr_changed( device);986 rc = eth_addr_changed(IPC_GET_ARG1(call)); 982 987 async_answer_0(callid, (sysarg_t) rc); 983 988 break;
Note:
See TracChangeset
for help on using the changeset viewer.