Merge pull request #73 from Masaq-/macipx

Patch to make MacIPX work in SheepShaver
This commit is contained in:
asvitkine 2015-08-09 18:14:18 -04:00
commit 7e111f6fc5
5 changed files with 623 additions and 589 deletions

View File

@ -255,12 +255,9 @@ static int sheep_net_open(struct inode *inode, struct file *f)
memset(v, 0, sizeof(struct SheepVars)); memset(v, 0, sizeof(struct SheepVars));
skb_queue_head_init(&v->queue); skb_queue_head_init(&v->queue);
init_waitqueue_head(&v->wait); init_waitqueue_head(&v->wait);
v->fake_addr[0] = 0xfe; v->fake_addr[0] = 'v'; /* "SheepShaver" */
v->fake_addr[1] = 0xfd; v->fake_addr[1] = 'r'; /* ^ ^ */
v->fake_addr[2] = 0xde; get_random_bytes(&v->fake_addr[2], 4);
v->fake_addr[3] = 0xad;
v->fake_addr[4] = 0xbe;
v->fake_addr[5] = 0xef;
/* Put our stuff where we will be able to find it later */ /* Put our stuff where we will be able to find it later */
f->private_data = (void *)v; f->private_data = (void *)v;

View File

@ -126,6 +126,7 @@ struct DLPIStream {
nw_uint32 flags; // Flags nw_uint32 flags; // Flags
nw_uint16 dlsap; // SAP bound to this stream nw_uint16 dlsap; // SAP bound to this stream
nw_bool framing_8022; // Using 802.2 framing? This is only used to report the MAC type for DL_INFO_ACK and can be set with an ioctl() call nw_bool framing_8022; // Using 802.2 framing? This is only used to report the MAC type for DL_INFO_ACK and can be set with an ioctl() call
nw_bool raw_mode; // Using raw mode? Header is treated as data
nw_queue_p rdq; // Read queue for this stream nw_queue_p rdq; // Read queue for this stream
nw_uint32 group_sap[kGroupSAPMapSize]; // Map of bound group SAPs nw_uint32 group_sap[kGroupSAPMapSize]; // Map of bound group SAPs
uint8 snap[k8022SNAPLength]; // SNAP bound to this stream uint8 snap[k8022SNAPLength]; // SNAP bound to this stream
@ -487,6 +488,7 @@ int ether_open(queue_t *rdq, void *dev, int flag, int sflag, void *creds)
the_stream->flags = 0; the_stream->flags = 0;
the_stream->dlsap = 0; the_stream->dlsap = 0;
the_stream->framing_8022 = false; the_stream->framing_8022 = false;
the_stream->raw_mode = false;
the_stream->multicast_list = NULL; the_stream->multicast_list = NULL;
return 0; return 0;
} }
@ -710,8 +712,8 @@ static void ether_ioctl(DLPIStream *the_stream, queue_t *q, mblk_t *mp)
} }
dlrc = (dl_recv_control_t *)(void *)info_mp->b_rptr; dlrc = (dl_recv_control_t *)(void *)info_mp->b_rptr;
D(bug(" I_OTSetRawMode primitive %d\n", (int)dlrc->dl_primitive)); D(bug(" I_OTSetRawMode primitive %d\n", (int)dlrc->dl_primitive));
ioc->ioc_error = MAC_EINVAL; the_stream->raw_mode = true;
goto ioctl_error; goto ioctl_ok;
} }
default: default:
@ -996,7 +998,8 @@ static void handle_received_packet(DLPIStream *the_stream, mblk_t *mp, uint16 pa
// In Fast Path mode, don't send DL_UNITDATA_IND messages for unicast packets // In Fast Path mode, don't send DL_UNITDATA_IND messages for unicast packets
if ((the_stream->flags & kFastPathMode) && dest_addr_type == keaStandardAddress) { if ((the_stream->flags & kFastPathMode) && dest_addr_type == keaStandardAddress) {
mp->b_rptr += header_len; if (the_stream->raw_mode == false)
mp->b_rptr += header_len;
num_rx_fastpath++; num_rx_fastpath++;
putq(the_stream->rdq, mp); putq(the_stream->rdq, mp);
return; return;
@ -1045,7 +1048,8 @@ static void handle_received_packet(DLPIStream *the_stream, mblk_t *mp, uint16 pa
} }
// "Hide" the ethernet and protocol header(s) // "Hide" the ethernet and protocol header(s)
mp->b_rptr += header_len; if (the_stream->raw_mode == false)
mp->b_rptr += header_len;
// Pass message up the stream // Pass message up the stream
num_unitdata_ind++; num_unitdata_ind++;

File diff suppressed because it is too large Load Diff

View File

@ -126,6 +126,7 @@ struct DLPIStream {
nw_uint32 flags; // Flags nw_uint32 flags; // Flags
nw_uint16 dlsap; // SAP bound to this stream nw_uint16 dlsap; // SAP bound to this stream
nw_bool framing_8022; // Using 802.2 framing? This is only used to report the MAC type for DL_INFO_ACK and can be set with an ioctl() call nw_bool framing_8022; // Using 802.2 framing? This is only used to report the MAC type for DL_INFO_ACK and can be set with an ioctl() call
nw_bool raw_mode; // Using raw mode? Header is treated as data
nw_queue_p rdq; // Read queue for this stream nw_queue_p rdq; // Read queue for this stream
nw_uint32 group_sap[kGroupSAPMapSize]; // Map of bound group SAPs nw_uint32 group_sap[kGroupSAPMapSize]; // Map of bound group SAPs
uint8 snap[k8022SNAPLength]; // SNAP bound to this stream uint8 snap[k8022SNAPLength]; // SNAP bound to this stream
@ -487,6 +488,7 @@ int ether_open(queue_t *rdq, void *dev, int flag, int sflag, void *creds)
the_stream->flags = 0; the_stream->flags = 0;
the_stream->dlsap = 0; the_stream->dlsap = 0;
the_stream->framing_8022 = false; the_stream->framing_8022 = false;
the_stream->raw_mode = false;
the_stream->multicast_list = NULL; the_stream->multicast_list = NULL;
return 0; return 0;
} }
@ -710,8 +712,8 @@ static void ether_ioctl(DLPIStream *the_stream, queue_t *q, mblk_t *mp)
} }
dlrc = (dl_recv_control_t *)(void *)info_mp->b_rptr; dlrc = (dl_recv_control_t *)(void *)info_mp->b_rptr;
D(bug(" I_OTSetRawMode primitive %d\n", (int)dlrc->dl_primitive)); D(bug(" I_OTSetRawMode primitive %d\n", (int)dlrc->dl_primitive));
ioc->ioc_error = MAC_EINVAL; the_stream->raw_mode = true;
goto ioctl_error; goto ioctl_ok;
} }
default: default:
@ -996,7 +998,8 @@ static void handle_received_packet(DLPIStream *the_stream, mblk_t *mp, uint16 pa
// In Fast Path mode, don't send DL_UNITDATA_IND messages for unicast packets // In Fast Path mode, don't send DL_UNITDATA_IND messages for unicast packets
if ((the_stream->flags & kFastPathMode) && dest_addr_type == keaStandardAddress) { if ((the_stream->flags & kFastPathMode) && dest_addr_type == keaStandardAddress) {
mp->b_rptr += header_len; if (the_stream->raw_mode == false)
mp->b_rptr += header_len;
num_rx_fastpath++; num_rx_fastpath++;
putq(the_stream->rdq, mp); putq(the_stream->rdq, mp);
return; return;
@ -1045,7 +1048,8 @@ static void handle_received_packet(DLPIStream *the_stream, mblk_t *mp, uint16 pa
} }
// "Hide" the ethernet and protocol header(s) // "Hide" the ethernet and protocol header(s)
mp->b_rptr += header_len; if (the_stream->raw_mode == false)
mp->b_rptr += header_len;
// Pass message up the stream // Pass message up the stream
num_unitdata_ind++; num_unitdata_ind++;