Changeset 14f1db0 in mainline for uspace/srv/net/nil/eth/eth.c


Ignore:
Timestamp:
2010-04-09T12:54:57Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1caa3c2
Parents:
24ab58b3
Message:

networking overhaul:

  • separation of conserns
  • removal of (almost all) overlaping symbols, libnetif is not needed anymore
  • again, it is possible to build the networking in multiple architecture configurations (however, currently only the bundling netif and nil layers is supported, more to come)
  • code style updates and fixes (still a huge amount of work to do)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/nil/eth/eth.c

    r24ab58b3 r14f1db0  
    6060#include <adt/measured_strings.h>
    6161#include <packet/packet_client.h>
    62 #include <nil_module.h>
     62#include <packet_remote.h>
     63#include <nil_local.h>
    6364
    6465#include "eth.h"
     
    271272INT_MAP_IMPLEMENT(eth_protos, eth_proto_t)
    272273
    273 int nil_device_state_msg(int nil_phone, device_id_t device_id, int state){
     274int nil_device_state_msg_local(int nil_phone, device_id_t device_id, int state){
    274275        int index;
    275276        eth_proto_ref proto;
     
    475476}
    476477
    477 int nil_received_msg(int nil_phone, device_id_t device_id, packet_t packet, services_t target){
     478int nil_received_msg_local(int nil_phone, device_id_t device_id, packet_t packet, services_t target){
    478479        eth_proto_ref proto;
    479480        packet_t next;
     
    497498                }else{
    498499                        // drop invalid/unknown
    499                         pq_release(eth_globals.net_phone, packet_get_id(packet));
     500                        pq_release_remote(eth_globals.net_phone, packet_get_id(packet));
    500501                }
    501502                packet = next;
     
    681682        ethertype = htons(protocol_map(SERVICE_ETHERNET, sender));
    682683        if(! ethertype){
    683                 pq_release(eth_globals.net_phone, packet_get_id(packet));
     684                pq_release_remote(eth_globals.net_phone, packet_get_id(packet));
    684685                return EINVAL;
    685686        }
     
    699700                                packet = tmp;
    700701                        }
    701                         pq_release(eth_globals.net_phone, packet_get_id(next));
     702                        pq_release_remote(eth_globals.net_phone, packet_get_id(next));
    702703                        next = tmp;
    703704                }else{
     
    713714}
    714715
    715 int nil_message(const char *name, ipc_callid_t callid, ipc_call_t *call,
     716int nil_message_standalone(const char *name, ipc_callid_t callid, ipc_call_t *call,
    716717    ipc_call_t *answer, int *answer_count)
    717718{
     
    733734                            IPC_GET_SERVICE(call), IPC_GET_MTU(call));
    734735                case NET_NIL_SEND:
    735                         ERROR_PROPAGATE(packet_translate(eth_globals.net_phone, &packet,
     736                        ERROR_PROPAGATE(packet_translate_remote(eth_globals.net_phone, &packet,
    736737                            IPC_GET_PACKET(call)));
    737738                        return eth_send_message(IPC_GET_DEVICE(call), packet,
     
    771772                switch(IPC_GET_METHOD(*icall)){
    772773                        case NET_NIL_DEVICE_STATE:
    773                                 nil_device_state_msg(0, IPC_GET_DEVICE(icall), IPC_GET_STATE(icall));
     774                                nil_device_state_msg_local(0, IPC_GET_DEVICE(icall), IPC_GET_STATE(icall));
    774775                                ipc_answer_0(iid, EOK);
    775776                                break;
    776777                        case NET_NIL_RECEIVED:
    777                                 if(! ERROR_OCCURRED(packet_translate(eth_globals.net_phone, &packet, IPC_GET_PACKET(icall)))){
    778                                         ERROR_CODE = nil_received_msg(0, IPC_GET_DEVICE(icall), packet, 0);
     778                                if(! ERROR_OCCURRED(packet_translate_remote(eth_globals.net_phone, &packet, IPC_GET_PACKET(icall)))){
     779                                        ERROR_CODE = nil_received_msg_local(0, IPC_GET_DEVICE(icall), packet, 0);
    779780                                }
    780781                                ipc_answer_0(iid, (ipcarg_t) ERROR_CODE);
     
    787788}
    788789
    789 #ifdef CONFIG_NETWORKING_modular
    790 
    791 #include <nil_standalone.h>
     790#ifndef CONFIG_NETIF_NIL_BUNDLE
    792791
    793792/** Default thread for new connections.
    794793 *
    795  *  @param[in] iid The initial message identifier.
    796  *  @param[in] icall The initial message call structure.
     794 * @param[in] iid The initial message identifier.
     795 * @param[in] icall The initial message call structure.
    797796 *
    798797 */
    799 static void nil_client_connection(ipc_callid_t iid, ipc_call_t * icall)
     798static void nil_client_connection(ipc_callid_t iid, ipc_call_t *icall)
    800799{
    801800        /*
     
    817816               
    818817                /* Process the message */
    819                 int res = nil_module_message(NAME, callid, &call, &answer,
     818                int res = nil_module_message_standalone(NAME, callid, &call, &answer,
    820819                    &answer_count);
    821820               
     
    829828}
    830829
    831 /** Starts the module.
    832  *
    833  *  @param argc The count of the command line arguments. Ignored parameter.
    834  *  @param argv The command line parameters. Ignored parameter.
    835  *
    836  *  @returns EOK on success.
    837  *  @returns Other error codes as defined for each specific module start function.
    838  *
    839  */
    840830int main(int argc, char *argv[])
    841831{
     
    843833       
    844834        /* Start the module */
    845         if (ERROR_OCCURRED(nil_module_start(nil_client_connection)))
     835        if (ERROR_OCCURRED(nil_module_start_standalone(nil_client_connection)))
    846836                return ERROR_CODE;
    847837       
     
    849839}
    850840
    851 #endif /* CONFIG_NETWORKING_modular */
     841#endif /* CONFIG_NETIF_NIL_BUNDLE */
    852842
    853843/** @}
Note: See TracChangeset for help on using the changeset viewer.