Changeset 7e45c5a in mainline


Ignore:
Timestamp:
2024-04-07T13:05:47Z (3 weeks ago)
Author:
GitHub <noreply@…>
Parents:
522eecf (diff), 2a0c827c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
boba-buba <120932204+boba-buba@…> (2024-04-07 13:05:47)
git-committer:
GitHub <noreply@…> (2024-04-07 13:05:47)
Message:

Merge 2a0c827c42eafb070de3bbe3c98a1d8a2b77d719 into 522eecf2e7a8efe0c2e371007898fcb15dccdfa1

Files:
13 added
17 edited

Legend:

Unmodified
Added
Removed
  • abi/include/abi/ipc/interfaces.h

    r522eecf r7e45c5a  
    202202            FOURCC_COMPACT('w', 'm', 'g', 't') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
    203203        INTERFACE_TBARCFG_NOTIFY =
    204             FOURCC_COMPACT('t', 'b', 'c', 'f') | IFACE_EXCHANGE_SERIALIZE
     204            FOURCC_COMPACT('t', 'b', 'c', 'f') | IFACE_EXCHANGE_SERIALIZE,
     205        INTERFACE_PCAP_CONTROL =
     206            FOURCC_COMPACT('p', 'c', 't', 'l') | IFACE_EXCHANGE_SERIALIZE,
    205207} iface_t;
    206208
  • uspace/app/meson.build

    r522eecf r7e45c5a  
    7272        'nic',
    7373        'nterm',
     74        'pcapctl',
    7475        'ofw',
    7576        'pci',
  • uspace/drv/nic/e1k/e1k.c

    r522eecf r7e45c5a  
    4949#include <nic.h>
    5050#include <ops/nic.h>
     51#include <pcapdump_iface.h>
    5152#include "e1k.h"
    5253
     
    174175        /** Lock for EEPROM access */
    175176        fibril_mutex_t eeprom_lock;
     177
    176178} e1000_t;
    177179
     
    11891191                if (frame != NULL) {
    11901192                        memcpy(frame->data, e1000->rx_frame_virt[next_tail], frame_size);
     1193
    11911194                        nic_received_frame(nic, frame);
    11921195                } else {
     
    21992202                goto err_fun_bind;
    22002203
    2201         rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
    2202         if (rc != EOK)
    2203                 goto err_add_to_cat;
    2204 
     2204        rc = nic_fun_add_to_cats(fun);
     2205        if (rc != EOK) {
     2206                ddf_msg(LVL_ERROR, "Failed adding function to categories");
     2207                ddf_fun_unbind(fun);
     2208                return rc;
     2209        }
    22052210        return EOK;
    22062211
    2207 err_add_to_cat:
    2208         ddf_fun_unbind(fun);
     2212        // err_add_to_cat:
     2213        // ddf_fun_unbind(fun);
    22092214err_fun_bind:
    22102215err_rx_structure:
     
    23662371
    23672372        memcpy(e1000->tx_frame_virt[tdt], data, size);
    2368 
    23692373        tx_descriptor_addr->phys_addr = PTR_TO_U64(e1000->tx_frame_phys[tdt]);
    23702374        tx_descriptor_addr->length = size;
  • uspace/drv/nic/e1k/meson.build

    r522eecf r7e45c5a  
    2727#
    2828
    29 deps = [ 'nic' ]
     29deps = [ 'nic' , 'pcap' ]
    3030src = files('e1k.c')
  • uspace/drv/nic/ne2k/ne2k.c

    r522eecf r7e45c5a  
    4343#include <str_error.h>
    4444#include <async.h>
     45#include <ddf/log.h>
    4546#include "dp8390.h"
    4647
     
    443444        }
    444445
    445         rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
     446        rc = nic_fun_add_to_cats(fun);
    446447        if (rc != EOK) {
     448                ddf_msg(LVL_ERROR, "Failed adding function to categories");
    447449                ddf_fun_unbind(fun);
    448                 ddf_fun_destroy(fun);
    449450                return rc;
    450451        }
     
    476477        nic_driver_implement(&ne2k_driver_ops, &ne2k_dev_ops, &ne2k_nic_iface);
    477478
     479        ddf_log_init(NAME);
    478480        return ddf_driver_main(&ne2k_driver);
    479481}
  • uspace/drv/nic/rtl8139/driver.c

    r522eecf r7e45c5a  
    4242#include <stdio.h>
    4343#include <str.h>
     44#include <pcapdump_iface.h>
    4445
    4546#include "defs.h"
     
    13071308                goto err_fun_create;
    13081309        }
    1309         rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
     1310
     1311        rc = nic_fun_add_to_cats(fun);
    13101312        if (rc != EOK) {
    1311                 ddf_msg(LVL_ERROR, "Failed adding function to category");
    1312                 goto err_fun_bind;
     1313                ddf_msg(LVL_ERROR, "Failed adding function to categories");
     1314                ddf_fun_unbind(fun);
     1315                return rc;
    13131316        }
    13141317
     
    13181321        return EOK;
    13191322
    1320 err_fun_bind:
    1321         ddf_fun_unbind(fun);
     1323        // err_fun_bind:
     1324        // ddf_fun_unbind(fun);
    13221325err_fun_create:
    13231326        ddf_fun_destroy(fun);
  • uspace/drv/nic/rtl8169/driver.c

    r522eecf r7e45c5a  
    457457        }
    458458
    459         rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
     459        rc = nic_fun_add_to_cats(fun);
    460460        if (rc != EOK) {
    461                 ddf_msg(LVL_ERROR, "Failed adding function to category");
    462                 goto err_fun_bind;
     461                ddf_msg(LVL_ERROR, "Failed adding function to categories");
     462                ddf_fun_unbind(fun);
     463                return rc;
    463464        }
    464465
     
    467468        return EOK;
    468469
    469 err_fun_bind:
    470         ddf_fun_unbind(fun);
     470        // err_fun_bind:
     471        // ddf_fun_unbind(fun);
    471472err_fun_create:
    472473        ddf_fun_destroy(fun);
  • uspace/drv/nic/virtio-net/virtio-net.c

    r522eecf r7e45c5a  
    4343
    4444#include <virtio-pci.h>
     45#include <pcapdump_iface.h>
    4546
    4647#define NAME    "virtio-net"
     
    422423        }
    423424
    424         rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
     425        rc = nic_fun_add_to_cats(fun);
    425426        if (rc != EOK) {
    426                 ddf_msg(LVL_ERROR, "Failed adding function to category");
    427                 goto unbind;
     427                ddf_msg(LVL_ERROR, "Failed adding function to categories");
     428                ddf_fun_unbind(fun);
     429                return rc;
    428430        }
    429431
     
    433435        return EOK;
    434436
    435 unbind:
    436         ddf_fun_unbind(fun);
     437        // unbind:
     438        // ddf_fun_unbind(fun);
    437439destroy:
    438440        ddf_fun_destroy(fun);
  • uspace/lib/c/include/ipc/services.h

    r522eecf r7e45c5a  
    6767#define SERVICE_NAME_VBD      "vbd"
    6868#define SERVICE_NAME_VOLSRV   "volsrv"
    69 
     69#define SERVICE_NAME_DUMPPCAP "dumppcap"
    7070#endif
    7171
  • uspace/lib/meson.build

    r522eecf r7e45c5a  
    8181        'minix',
    8282        'nettl',
     83        'pcap',
    8384        'ofw',
    8485        'pcm',
  • uspace/lib/nic/include/nic.h

    r522eecf r7e45c5a  
    4444#include <device/hw_res_parsed.h>
    4545#include <ops/nic.h>
     46#include <pcap_iface.h>
    4647
    4748#define DEVICE_CATEGORY_NIC "nic"
     
    278279extern void nic_sw_period_stop(nic_t *);
    279280
     281/* pcapdump interface */
     282extern pcap_iface_t *nic_get_pcap_iface(nic_t *);
     283
     284extern errno_t nic_fun_add_to_cats(ddf_fun_t *fun);
     285
    280286#endif // __NIC_H__
    281287
  • uspace/lib/nic/include/nic_driver.h

    r522eecf r7e45c5a  
    4646#include <nic/nic.h>
    4747#include <async.h>
     48#include <pcapdump_iface.h>
    4849
    4950#include "nic.h"
     
    195196         */
    196197        poll_request_handler on_poll_request;
     198
     199        /** Interface for dumping packets */
     200        pcap_iface_t pcapdump;
     201
    197202        /** Data specific for particular driver */
    198203        void *specific;
  • uspace/lib/nic/include/nic_impl.h

    r522eecf r7e45c5a  
    8787extern void nic_close_impl(ddf_fun_t *fun);
    8888
    89 extern void nic_device_added_impl(ddf_dev_t *dev);
    90 
    9189#endif
    9290
  • uspace/lib/nic/meson.build

    r522eecf r7e45c5a  
    2727#
    2828
    29 deps = [ 'drv' ]
     29deps = [ 'drv' , 'pcap' ]
    3030c_args = [ '-DLIBNIC_INTERNAL', ]
    3131src = files(
  • uspace/lib/nic/src/nic_driver.c

    r522eecf r7e45c5a  
    4747#include <ops/nic.h>
    4848#include <errno.h>
     49#include <pcapdump_iface.h>
    4950
    5051#include "nic_driver.h"
     
    522523         *               calls it inside send_frame handler (with locked main lock)
    523524         */
     525        pcapdump_packet(nic_get_pcap_iface(nic_data), frame->data, frame->size);
    524526        fibril_rwlock_read_lock(&nic_data->rxc_lock);
    525527        nic_frame_type_t frame_type;
     
    560562                fibril_rwlock_write_unlock(&nic_data->stats_lock);
    561563        }
     564        //pcapdump_packet(nic_get_pcap_iface(nic_data), frame->data, frame->size);
    562565        nic_release_frame(nic_data, frame);
    563566}
     
    648651        nic_data->dev = device;
    649652
     653        errno_t pcap_rc  = pcapdump_init(nic_get_pcap_iface(nic_data));
     654        if (pcap_rc != EOK) {
     655                printf("Failed creating pcapdump port\n");
     656        }
     657
    650658        return nic_data;
    651659}
     
    11331141}
    11341142
     1143pcap_iface_t *nic_get_pcap_iface(nic_t *nic_data)
     1144{
     1145        return &nic_data->pcapdump;
     1146}
     1147
    11351148/** @}
    11361149 */
  • uspace/lib/nic/src/nic_impl.c

    r522eecf r7e45c5a  
    4040#include <ipc/services.h>
    4141#include <ns.h>
     42#include <pcapdump_iface.h>
    4243#include "nic_driver.h"
    4344#include "nic_ev.h"
     
    179180                return EBUSY;
    180181        }
    181 
     182        pcapdump_packet(nic_get_pcap_iface(nic_data), data, size);
    182183        nic_data->send_frame(nic_data, data, size);
    183184        fibril_rwlock_read_unlock(&nic_data->main_lock);
     
    843844}
    844845
     846errno_t nic_fun_add_to_cats(ddf_fun_t *fun)
     847{
     848        errno_t rc;
     849        rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
     850        if (rc != EOK)
     851                goto err_add_to_cat;
     852
     853        rc = ddf_fun_add_to_category(fun, "pcap");
     854        if (rc != EOK) {
     855                //ddf_msg(LVL_ERROR, "Failed adding function to category pcap");
     856                goto err_add_to_cat;
     857        }
     858        return EOK;
     859
     860err_add_to_cat:
     861        ddf_fun_unbind(fun);
     862        return rc;
     863}
     864
    845865/** @}
    846866 */
  • uspace/srv/locsrv/locsrv.c

    r522eecf r7e45c5a  
    13931393        categ_dir_add_cat(&cdir, cat);
    13941394
     1395        cat = category_new("pcap");
     1396        categ_dir_add_cat(&cdir, cat);
    13951397        return true;
    13961398}
Note: See TracChangeset for help on using the changeset viewer.