Changeset 4f64a523 in mainline for uspace/srv/ethip
- Timestamp:
- 2012-02-12T19:36:32Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- df15e5f
- Parents:
- 1493811
- Location:
- uspace/srv/ethip
- Files:
-
- 2 edited
-
ethip.c (modified) (6 diffs)
-
ethip_nic.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/ethip/ethip.c
r1493811 r4f64a523 52 52 #define NAME "eth" 53 53 54 static int ethip_open(iplink_ conn_t *conn);55 static int ethip_close(iplink_ conn_t *conn);56 static int ethip_send(iplink_ conn_t *conn, iplink_srv_sdu_t *sdu);57 static int ethip_get_mtu(iplink_ conn_t *conn, size_t *mtu);54 static int ethip_open(iplink_srv_t *srv); 55 static int ethip_close(iplink_srv_t *srv); 56 static int ethip_send(iplink_srv_t *srv, iplink_srv_sdu_t *sdu); 57 static int ethip_get_mtu(iplink_srv_t *srv, size_t *mtu); 58 58 59 59 static void ethip_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg); … … 95 95 log_msg(LVL_DEBUG, "ethip_iplink_init()"); 96 96 97 iplink_srv_init(&nic->iplink); 97 98 nic->iplink.ops = ðip_iplink_ops; 98 99 nic->iplink.arg = nic; … … 148 149 } 149 150 150 static int ethip_open(iplink_ conn_t *conn)151 static int ethip_open(iplink_srv_t *srv) 151 152 { 152 153 log_msg(LVL_DEBUG, "ethip_open()"); … … 154 155 } 155 156 156 static int ethip_close(iplink_ conn_t *conn)157 { 158 log_msg(LVL_DEBUG, "ethip_ open()");159 return EOK; 160 } 161 162 static int ethip_send(iplink_ conn_t *conn, iplink_srv_sdu_t *sdu)163 { 164 ethip_nic_t *nic = (ethip_nic_t *) conn->srv->arg;157 static int ethip_close(iplink_srv_t *srv) 158 { 159 log_msg(LVL_DEBUG, "ethip_close()"); 160 return EOK; 161 } 162 163 static int ethip_send(iplink_srv_t *srv, iplink_srv_sdu_t *sdu) 164 { 165 ethip_nic_t *nic = (ethip_nic_t *)srv->arg; 165 166 eth_frame_t frame; 166 167 void *data; … … 188 189 int ethip_received(iplink_srv_t *srv, void *data, size_t size) 189 190 { 191 log_msg(LVL_DEBUG, "ethip_received(): srv=%p", srv); 192 ethip_nic_t *nic = (ethip_nic_t *)srv->arg; 190 193 eth_frame_t frame; 191 194 iplink_srv_sdu_t sdu; 192 195 int rc; 193 196 197 log_msg(LVL_DEBUG, "ethip_received()"); 198 199 log_msg(LVL_DEBUG, " - eth_pdu_decode"); 194 200 rc = eth_pdu_decode(data, size, &frame); 195 if (rc != EOK) 196 return rc; 197 201 if (rc != EOK) { 202 log_msg(LVL_DEBUG, " - eth_pdu_decode failed"); 203 return rc; 204 } 205 206 log_msg(LVL_DEBUG, " - construct SDU"); 207 sdu.lsrc.ipv4 = (192 << 24) | (168 << 16) | (0 << 8) | 1; 208 sdu.ldest.ipv4 = (192 << 24) | (168 << 16) | (0 << 8) | 4; 198 209 sdu.data = frame.data; 199 210 sdu.size = frame.size; 200 (void) sdu;201 //rc = iplink_ev_recv(conn, &sdu);211 log_msg(LVL_DEBUG, " - call iplink_ev_recv"); 212 rc = iplink_ev_recv(&nic->iplink, &sdu); 202 213 203 214 free(frame.data); … … 205 216 } 206 217 207 static int ethip_get_mtu(iplink_ conn_t *conn, size_t *mtu)218 static int ethip_get_mtu(iplink_srv_t *srv, size_t *mtu) 208 219 { 209 220 log_msg(LVL_DEBUG, "ethip_get_mtu()"); -
uspace/srv/ethip/ethip_nic.c
r1493811 r4f64a523 158 158 } 159 159 160 rc = nic_set_state(nic->sess, NIC_STATE_ACTIVE);161 if (rc != EOK) {162 log_msg(LVL_ERROR, "Failed activating NIC '%s'.",163 nic->svc_name);164 goto error;165 }166 167 160 log_msg(LVL_DEBUG, "Opened NIC '%s'", nic->svc_name); 168 161 list_append(&nic->nic_list, ðip_nic_list); … … 172 165 if (rc != EOK) 173 166 goto error; 167 168 rc = nic_set_state(nic->sess, NIC_STATE_ACTIVE); 169 if (rc != EOK) { 170 log_msg(LVL_ERROR, "Failed activating NIC '%s'.", 171 nic->svc_name); 172 goto error; 173 } 174 174 175 175 log_msg(LVL_DEBUG, "Initialized IP link service."); … … 205 205 size_t size; 206 206 207 log_msg(LVL_DEBUG, "ethip_nic_received() ");207 log_msg(LVL_DEBUG, "ethip_nic_received() nic=%p", nic); 208 208 209 209 rc = async_data_write_accept(&data, false, 0, 0, 0, &size); … … 213 213 } 214 214 215 log_msg(LVL_DEBUG, "call ethip_received"); 215 216 rc = ethip_received(&nic->iplink, data, size); 217 log_msg(LVL_DEBUG, "free data"); 216 218 free(data); 217 219 … … 228 230 static void ethip_nic_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg) 229 231 { 230 ethip_nic_t *nic ;232 ethip_nic_t *nic = (ethip_nic_t *)arg; 231 233 232 234 log_msg(LVL_DEBUG, "ethnip_nic_cb_conn()");
Note:
See TracChangeset
for help on using the changeset viewer.
