Changes in uspace/lib/nic/src/nic_impl.c [9cd8165:6d8455d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nic/src/nic_impl.c
r9cd8165 r6d8455d 36 36 */ 37 37 38 #include <errno.h>39 38 #include <str_error.h> 40 39 #include <ipc/services.h> 41 40 #include <ns.h> 42 41 #include "nic_driver.h" 43 #include "nic_ev.h"44 42 #include "nic_impl.h" 45 43 … … 87 85 } 88 86 if (state == NIC_STATE_ACTIVE) { 89 if (nic_data->client_session == NULL) { 87 if (nic_data->nil_session == NULL || nic_data->net_session == NULL 88 || nic_data->device_id < 0) { 90 89 fibril_rwlock_write_unlock(&nic_data->main_lock); 91 90 return EINVAL; … … 117 116 if (state == NIC_STATE_STOPPED) { 118 117 /* Notify upper layers that we are reseting the MAC */ 119 int rc = ni c_ev_addr_changed(nic_data->client_session,120 &nic_data->default_mac);118 int rc = nil_addr_changed_msg(nic_data->nil_session, 119 nic_data->device_id, &nic_data->default_mac); 121 120 nic_data->poll_mode = nic_data->default_poll_mode; 122 121 memcpy(&nic_data->poll_period, &nic_data->default_poll_period, … … 150 149 nic_data->state = state; 151 150 152 ni c_ev_device_state(nic_data->client_session, state);151 nil_device_state_msg(nic_data->nil_session, nic_data->device_id, state); 153 152 154 153 fibril_rwlock_write_unlock(&nic_data->main_lock); … … 183 182 184 183 /** 185 * Default implementation of the connect_ clientmethod.186 * C reates callback connection to the client.184 * Default implementation of the connect_to_nil method. 185 * Connects the driver to the NIL service. 187 186 * 188 187 * @param fun 189 * 190 * @return EOK On success, or negative error code. 191 */ 192 int nic_callback_create_impl(ddf_fun_t *fun) 193 { 194 nic_t *nic = (nic_t *) fun->driver_data; 195 fibril_rwlock_write_lock(&nic->main_lock); 188 * @param nil_service ID of the server implementing the NIL service 189 * @param device_id ID of the device as used in higher layers 190 * 191 * @return EOK If the services were bound 192 * @return Negative error code from service_connect_blocking 193 */ 194 int nic_connect_to_nil_impl(ddf_fun_t *fun, services_t nil_service, 195 nic_device_id_t device_id) 196 { 197 nic_t *nic_data = (nic_t *) fun->driver_data; 198 fibril_rwlock_write_lock(&nic_data->main_lock); 196 199 197 nic->client_session = async_callback_receive(EXCHANGE_SERIALIZE); 198 if (nic->client_session == NULL) { 199 fibril_rwlock_write_unlock(&nic->main_lock); 200 return ENOMEM; 201 } 200 nic_data->device_id = device_id; 202 201 203 fibril_rwlock_write_unlock(&nic->main_lock); 204 return EOK; 202 nic_data->nil_session = service_connect_blocking(EXCHANGE_SERIALIZE, 203 nil_service, 0, 0); 204 if (nic_data->nil_session != NULL) { 205 fibril_rwlock_write_unlock(&nic_data->main_lock); 206 return EOK; 207 } 208 209 fibril_rwlock_write_unlock(&nic_data->main_lock); 210 return EHANGUP; 205 211 } 206 212 … … 799 805 } 800 806 807 /** Default implementation of the device_added method 808 * 809 * Just calls nic_ready. 810 * 811 * @param dev 812 * 813 */ 814 void nic_device_added_impl(ddf_dev_t *dev) 815 { 816 nic_ready((nic_t *) dev->driver_data); 817 } 818 801 819 /** 802 820 * Default handler for unknown methods (outside of the NIC interface).
Note:
See TracChangeset
for help on using the changeset viewer.