Changeset 87488278 in mainline


Ignore:
Timestamp:
2024-06-27T08:07:31Z (4 days ago)
Author:
GitHub <noreply@…>
Parents:
af3235d (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-06-27 08:07:31)
git-committer:
GitHub <noreply@…> (2024-06-27 08:07:31)
Message:

Merge 2a0c827c42eafb070de3bbe3c98a1d8a2b77d719 into af3235d07726dfc8b146c760a25544ea3ac29f9d

Files:
13 added
17 edited

Legend:

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

    raf3235d r87488278  
    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

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

    raf3235d r87488278  
    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 {
     
    21982201                goto err_fun_bind;
    21992202
    2200         rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
    2201         if (rc != EOK)
    2202                 goto err_add_to_cat;
    2203 
     2203        rc = nic_fun_add_to_cats(fun);
     2204        if (rc != EOK) {
     2205                ddf_msg(LVL_ERROR, "Failed adding function to categories");
     2206                ddf_fun_unbind(fun);
     2207                return rc;
     2208        }
    22042209        return EOK;
    22052210
    2206 err_add_to_cat:
    2207         ddf_fun_unbind(fun);
     2211        // err_add_to_cat:
     2212        // ddf_fun_unbind(fun);
    22082213err_fun_bind:
    22092214err_rx_structure:
     
    23652370
    23662371        memcpy(e1000->tx_frame_virt[tdt], data, size);
    2367 
    23682372        tx_descriptor_addr->phys_addr = PTR_TO_U64(e1000->tx_frame_phys[tdt]);
    23692373        tx_descriptor_addr->length = size;
  • uspace/drv/nic/e1k/meson.build

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

    raf3235d r87488278  
    4343#include <str_error.h>
    4444#include <async.h>
     45#include <ddf/log.h>
    4546#include "dp8390.h"
    4647
     
    449450        }
    450451
    451         rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
     452        rc = nic_fun_add_to_cats(fun);
    452453        if (rc != EOK) {
     454                ddf_msg(LVL_ERROR, "Failed adding function to categories");
    453455                ddf_fun_unbind(fun);
    454                 ddf_fun_destroy(fun);
    455456                return rc;
    456457        }
     
    482483        nic_driver_implement(&ne2k_driver_ops, &ne2k_dev_ops, &ne2k_nic_iface);
    483484
     485        ddf_log_init(NAME);
    484486        return ddf_driver_main(&ne2k_driver);
    485487}
  • uspace/drv/nic/rtl8139/driver.c

    raf3235d r87488278  
    4242#include <stdio.h>
    4343#include <str.h>
     44#include <pcapdump_iface.h>
    4445
    4546#include "defs.h"
     
    13051306                goto err_fun_create;
    13061307        }
    1307         rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
     1308
     1309        rc = nic_fun_add_to_cats(fun);
    13081310        if (rc != EOK) {
    1309                 ddf_msg(LVL_ERROR, "Failed adding function to category");
    1310                 goto err_fun_bind;
     1311                ddf_msg(LVL_ERROR, "Failed adding function to categories");
     1312                ddf_fun_unbind(fun);
     1313                return rc;
    13111314        }
    13121315
     
    13161319        return EOK;
    13171320
    1318 err_fun_bind:
    1319         ddf_fun_unbind(fun);
     1321        // err_fun_bind:
     1322        // ddf_fun_unbind(fun);
    13201323err_fun_create:
    13211324        ddf_fun_destroy(fun);
  • uspace/drv/nic/rtl8169/driver.c

    raf3235d r87488278  
    458458        }
    459459
    460         rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
     460        rc = nic_fun_add_to_cats(fun);
    461461        if (rc != EOK) {
    462                 ddf_msg(LVL_ERROR, "Failed adding function to category");
    463                 goto err_fun_bind;
     462                ddf_msg(LVL_ERROR, "Failed adding function to categories");
     463                ddf_fun_unbind(fun);
     464                return rc;
    464465        }
    465466
     
    468469        return EOK;
    469470
    470 err_fun_bind:
    471         ddf_fun_unbind(fun);
     471        // err_fun_bind:
     472        // ddf_fun_unbind(fun);
    472473err_fun_create:
    473474        ddf_fun_destroy(fun);
  • uspace/drv/nic/virtio-net/virtio-net.c

    raf3235d r87488278  
    4343
    4444#include <virtio-pci.h>
     45#include <pcapdump_iface.h>
    4546
    4647#define NAME    "virtio-net"
     
    428429        }
    429430
    430         rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
     431        rc = nic_fun_add_to_cats(fun);
    431432        if (rc != EOK) {
    432                 ddf_msg(LVL_ERROR, "Failed adding function to category");
    433                 goto unbind;
     433                ddf_msg(LVL_ERROR, "Failed adding function to categories");
     434                ddf_fun_unbind(fun);
     435                return rc;
    434436        }
    435437
     
    439441        return EOK;
    440442
    441 unbind:
    442         ddf_fun_unbind(fun);
     443        // unbind:
     444        // ddf_fun_unbind(fun);
    443445destroy:
    444446        ddf_fun_destroy(fun);
  • uspace/lib/c/include/ipc/services.h

    raf3235d r87488278  
    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

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

    raf3235d r87488278  
    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

    raf3235d r87488278  
    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

    raf3235d r87488278  
    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

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

    raf3235d r87488278  
    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

    raf3235d r87488278  
    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

    raf3235d r87488278  
    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.