Skip to content

Commit 01d65e5

Browse files
committed
ETH: updates to eth_reader_refactor
- Move variables - Update write_queue_peak - More ETH_MAC frobbing
1 parent 148d921 commit 01d65e5

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

sim_ether.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,13 +1971,14 @@ ETH_DEV *dev;
19711971
int status = 0;
19721972
int (*queue_func)(const ETH_DEV *);
19731973

1974-
sim_debug(dev->dbit, dev->dptr, "Reader Thread Starting\n");
19751974
dev = thr_info->eth_device;
19761975
#if !defined(__APPLE__)
19771976
pthread_setname_np(pthread_self(), thr_info->thr_name);
19781977
#else
19791978
pthread_setname_np(thr_info->thr_name);
19801979
#endif
1980+
1981+
sim_debug(dev->dbit, dev->dptr, "Reader Thread Starting\n");
19811982
dev->reader_status = ETH_THREAD_RUNNING;
19821983

19831984
/* Boost Priority for this I/O thread vs the CPU instruction execution
@@ -2188,13 +2189,14 @@ ETH_WRITE_REQUEST *request = NULL;
21882189
this thread needs to run */
21892190
sim_os_set_thread_priority (PRIORITY_ABOVE_NORMAL);
21902191

2191-
sim_debug(dev->dbit, dev->dptr, "Writer Thread Starting\n");
21922192
dev = thr_info->eth_device;
21932193
#if !defined(__APPLE__)
21942194
pthread_setname_np(pthread_self(), thr_info->thr_name);
21952195
#else
21962196
pthread_setname_np(thr_info->thr_name);
21972197
#endif
2198+
2199+
sim_debug(dev->dbit, dev->dptr, "Writer Thread Starting\n");
21982200
dev->writer_status = ETH_THREAD_IDLE;
21992201

22002202
/* Signal that we've started... */
@@ -2880,7 +2882,6 @@ uint32 i;
28802882
int responses = 0;
28812883
uint32 offset, function;
28822884
char mac_string[32];
2883-
ETH_MAC filter_mac[1];
28842885

28852886
if (reflections)
28862887
*reflections = 0;
@@ -2971,8 +2972,7 @@ eth_copy_mac(&send.msg[18], mac); /* Forward Destination *
29712972
send.msg[24] = 1; /* Reply */
29722973
send.msg[25] = 0;
29732974

2974-
eth_copy_mac(filter_mac[0], mac); /* target address */
2975-
eth_filter(dev, 1, filter_mac, 0, 0);
2975+
eth_filter(dev, 1, (const ETH_MAC *) mac, 0, 0);
29762976

29772977
/* send the packet */
29782978
status = _eth_write (dev, &send, NULL);
@@ -3283,6 +3283,7 @@ while (*last_request != NULL) {
32833283
++write_queue_size;
32843284
}
32853285
*last_request = request;
3286+
++write_queue_size;
32863287
if (write_queue_size > dev->write_queue_peak)
32873288
dev->write_queue_peak = write_queue_size;
32883289

@@ -3841,8 +3842,8 @@ switch (dev->eth_api) {
38413842
eth_packet_trace (dev, data, header->len, "received");
38423843

38433844
for (i = 0; i < dev->addr_count; i++) {
3844-
if (memcmp(data, dev->filter_address[i], 6) == 0) to_me = 1;
3845-
if (memcmp(&data[6], dev->filter_address[i], 6) == 0) from_me = 1;
3845+
if (eth_mac_cmp(data, dev->filter_address[i]) == 0) to_me = 1;
3846+
if (eth_mac_cmp(&data[6], dev->filter_address[i]) == 0) from_me = 1;
38463847
}
38473848

38483849
/* all multicast mode? */
@@ -4098,7 +4099,7 @@ if (status < 0) {
40984099
return status;
40994100
}
41004101

4101-
t_stat eth_bpf_filter (ETH_DEV* dev, int addr_count, ETH_MAC* const filter_address,
4102+
t_stat eth_bpf_filter (ETH_DEV* dev, int addr_count, const ETH_MAC filter_address[],
41024103
ETH_BOOL all_multicast, ETH_BOOL promiscuous,
41034104
int reflections,
41044105
ETH_MAC physical_addr,
@@ -4224,7 +4225,7 @@ if (!dev) return SCPE_UNATT;
42244225
if ((addr_count < 0) || ((addr_count + (match_broadcast ? 1 : 0)) > ETH_FILTER_MAX))
42254226
return SCPE_ARG;
42264227
else
4227-
if (!addresses && (addr_count != 0))
4228+
if (addr_count != 0)
42284229
return SCPE_ARG;
42294230

42304231
/* test reflections. This is done early in this routine since eth_reflect */

0 commit comments

Comments
 (0)