Skip to content

Commit 5772dc8

Browse files
authored
Revert "Upgrade to mainstream lwip 2.2.1"
1 parent f264a66 commit 5772dc8

File tree

19 files changed

+26
-228
lines changed

19 files changed

+26
-228
lines changed

download_dependencies.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ if [ "x$1" != "xlocked" ]; then
1414
fi
1515

1616
## Download LWIP
17-
LWIP_REPO_URL="https://github.com/lwip-tcpip/lwip.git"
17+
LWIP_REPO_URL="https://github.com/ps2dev/lwip.git"
1818
LWIP_REPO_FOLDER="common/external_deps/lwip"
19-
LWIP_BRANCH_NAME="STABLE-2_2_1_RELEASE"
19+
LWIP_BRANCH_NAME="ps2-v2.0.3"
2020
if test ! -d "$LWIP_REPO_FOLDER"; then
2121
git clone --depth 1 -b $LWIP_BRANCH_NAME $LWIP_REPO_URL "$LWIP_REPO_FOLDER"_inprogress || exit 1
2222
mv "$LWIP_REPO_FOLDER"_inprogress "$LWIP_REPO_FOLDER"
2323
else
24-
(cd "$LWIP_REPO_FOLDER" && git fetch origin --tags && git reset --hard "${LWIP_BRANCH_NAME}" && git checkout "$LWIP_BRANCH_NAME" && cd - )|| exit 1
24+
(cd "$LWIP_REPO_FOLDER" && git fetch origin && git reset --hard "origin/${LWIP_BRANCH_NAME}" && git checkout "$LWIP_BRANCH_NAME" && cd - )|| exit 1
2525
fi
2626

2727
## Download libsmb2

ee/network/tcpip/Makefile

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -35,42 +35,9 @@ endif
3535

3636
EE_INCS += -I$(LWIP)/src/include -I$(LWIP)/src/include/ipv4
3737

38-
ps2api_OBJECTS = \
39-
api_lib.o \
40-
api_msg.o \
41-
api_netbuf.o \
42-
err.o \
43-
sockets.o \
44-
tcpip.o
45-
46-
ps2api_IPV4 = \
47-
acd.o \
48-
icmp.o \
49-
ip.o \
50-
ip4.o \
51-
ip4_addr.o \
52-
ip4_frag.o \
53-
inet_chksum.o
54-
55-
ps2ip_OBJECTS = \
56-
sys.o \
57-
lwip_init.o \
58-
mem.o \
59-
netif.o \
60-
pbuf.o \
61-
stats.o \
62-
tcp_in.o \
63-
tcp_out.o \
64-
udp.o \
65-
memp.o \
66-
tcp.o \
67-
ethernet.o \
68-
etharp.o \
69-
raw.o \
70-
def.o \
71-
timeouts.o \
72-
$(ps2api_IPV4) \
73-
$(ps2api_OBJECTS)
38+
ps2api_OBJECTS = api_lib.o api_msg.o api_netbuf.o err.o sockets.o tcpip.o
39+
ps2api_IPV4 = icmp.o ip.o ip4.o ip4_addr.o ip4_frag.o inet_chksum.o
40+
ps2ip_OBJECTS = sys.o lwip_init.o mem.o netif.o pbuf.o stats.o tcp_in.o tcp_out.o udp.o memp.o tcp.o ethernet.o etharp.o raw.o def.o timeouts.o $(ps2api_IPV4) $(ps2api_OBJECTS)
7441

7542
ifdef PS2IP_DHCP
7643
ps2ip_OBJECTS += dhcp.o
@@ -115,9 +82,6 @@ $(EE_OBJS_DIR)api_msg.o: $(LWIP)/src/api/api_msg.c
11582
$(EE_OBJS_DIR)api_netbuf.o: $(LWIP)/src/api/netbuf.c
11683
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
11784

118-
$(EE_OBJS_DIR)acd.o: $(LWIP)/src/core/ipv4/acd.c
119-
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
120-
12185
$(EE_OBJS_DIR)icmp.o: $(LWIP)/src/core/ipv4/icmp.c
12286
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
12387

ee/network/tcpip/src/include/arch/cc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <errno.h>
55
#include <stdlib.h>
66
#include <stddef.h>
7-
#include <sys/select.h>
87

98
#define PACK_STRUCT_FIELD(x) x __attribute((packed))
109
#define PACK_STRUCT_STRUCT __attribute((packed))

ee/network/tcpip/src/include/lwipopts.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,6 @@
244244
*/
245245
#define LWIP_CHECKSUM_ON_COPY 1
246246

247-
/* Define LWIP_ERRNO_STDINCLUDE if you want to include <errno.h> here */
248-
#define LWIP_ERRNO_STDINCLUDE 1
249247
/*
250248
------------------------------------
251249
---------- Socket options ----------

ee/network/tcpip/src/ps2ip_internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#ifndef IOP_PS2IP_INTERNAL_H
1212
#define IOP_PS2IP_INTERNAL_H
1313

14-
#include <sys/select.h>
1514
#include "lwip/sockets.h"
1615

1716
typedef struct

ee/network/tcpip/src/sys_arch.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,6 @@ err_t sys_mbox_trypost(sys_mbox_t *mbox, void *sys_msg)
338338
return result;
339339
}
340340

341-
err_t sys_mbox_trypost_fromisr(sys_mbox_t *mbox, void *msg)
342-
{
343-
// On PS2 EE, ISR and task level are the same, so just call trypost
344-
return sys_mbox_trypost(mbox, msg);
345-
}
346-
347341
void sys_mbox_post(sys_mbox_t *mbox, void *sys_msg)
348342
{
349343
SendMbx(mbox, alloc_msg(), sys_msg);

iop/network/smap/src/imports.lst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ I_inet_addr
6363
I_tcpip_input
6464
I_netif_set_link_up
6565
I_netif_set_link_down
66-
I_tcpip_callback
66+
I_tcpip_callback_with_block
6767
ps2ip_IMPORTS_end
6868
#endif
6969

iop/tcpip/tcpip-base/include/arch/cc.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#ifndef __CC_H__
22
#define __CC_H__
33

4+
#include <errno.h>
45
#include <stddef.h>
5-
#include <sys/time.h>
66

77
#define BYTE_ORDER LITTLE_ENDIAN
88

@@ -47,6 +47,8 @@ typedef u32_t mem_ptr_t;
4747
#define LWIP_PLATFORM_ASSERT(args)
4848
#endif
4949

50+
#define atoi(x) strtol(x, NULL, 10)
51+
5052
#define LWIP_NO_STDINT_H 1 //stdint.h does not exist.
5153
#define LWIP_NO_INTTYPES_H 1 //inttypes.h does not exist.
5254

iop/tcpip/tcpip-base/include/lwipopts.h

Lines changed: 3 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,6 @@
8686
byte alignment -> define MEM_ALIGNMENT to 2. */
8787
#define MEM_ALIGNMENT 4
8888

89-
/**
90-
* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT==1: allows mem_free() to be called
91-
* from ISR/different task context (uses SYS_ARCH_PROTECT instead of mutex).
92-
* Required on IOP because interrupt context may free pbufs.
93-
*/
94-
#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1
95-
9689
/**
9790
* MEM_SIZE: the size of the heap memory. If the application will send
9891
* a lot of data that needs to be copied, this should be set high.
@@ -101,60 +94,11 @@
10194
Up to TCP_SND_BUF * 2 segments may be transmitted at once, thanks to Nagle and Delayed Ack. */
10295
#define MEM_SIZE (TCP_SND_BUF * 2)
10396

104-
/*
105-
-----------------------------------------------
106-
---------- IP options -------------------------
107-
-----------------------------------------------
108-
*/
109-
/**
110-
* IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets.
111-
* Disabled: PS2 always operates on a local LAN; IP fragments never occur
112-
* with MSS=1460 and MTU=1500. Saves MEMP_NUM_REASSDATA pool entries.
113-
*/
114-
#define IP_REASSEMBLY 0
115-
116-
/**
117-
* IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU.
118-
* Disabled: TCP_MSS=1460 ensures we never exceed Ethernet MTU=1500.
119-
*/
120-
#define IP_FRAG 0
121-
12297
/*
12398
------------------------------------------------
12499
---------- Internal Memory Pool Sizes ----------
125100
------------------------------------------------
126101
*/
127-
/**
128-
* MEMP_NUM_TCP_PCB: the number of simultaneously active TCP connections.
129-
* ps2link handles at most a few simultaneous TCP connections.
130-
*/
131-
#define MEMP_NUM_TCP_PCB 4
132-
133-
/**
134-
* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
135-
* ps2link listens on a small number of ports.
136-
*/
137-
#define MEMP_NUM_TCP_PCB_LISTEN 4
138-
139-
/**
140-
* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks.
141-
* DNS (1) + DHCP (1) internally allocate raw UDP PCBs via udp_new(),
142-
* plus application sockets (udptty 1, ps2link 1) need their own.
143-
*/
144-
#define MEMP_NUM_UDP_PCB 4
145-
146-
/**
147-
* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
148-
* Must be at least TCP_SND_QUEUELEN (enforced by lwIP sanity check in init.c).
149-
*/
150-
#define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN
151-
152-
/**
153-
* MEMP_NUM_ARP_QUEUE: the number of ARP queued packets.
154-
* ps2link communicates with a single host; 5 entries is more than enough.
155-
*/
156-
#define MEMP_NUM_ARP_QUEUE 5
157-
158102
/**
159103
* MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
160104
* for incoming packets.
@@ -181,15 +125,8 @@
181125

182126
/**
183127
* PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
184-
* Each pool entry is ~1532 bytes (PBUF_POOL_BUFSIZE ≈ 1516 + struct pbuf).
185-
* Reduced from 32 (~49 KB) to 12 (~18 KB). Safe because
186-
* LWIP_TCPIP_CORE_LOCKING_INPUT=1 means RX is processed synchronously,
187-
* so the pool backlog stays very small.
188-
* Must satisfy: TCP_WND <= PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - 54).
189-
* With PBUF_POOL_SIZE=12 and PBUF_POOL_BUFSIZE=1516: max = 12 * 1462 = 17544.
190-
* 16384 (16 KB) fits comfortably.
191128
*/
192-
#define PBUF_POOL_SIZE 12
129+
#define PBUF_POOL_SIZE 32 //SP193: should be at least ((TCP_WND/PBUF_POOL_BUFSIZE)+1). But that is too small to handle simultaneous connections.
193130

194131
/**
195132
* LWIP_TCPIP_CORE_LOCKING_INPUT: when LWIP_TCPIP_CORE_LOCKING is enabled,
@@ -219,11 +156,8 @@
219156
/* TCP sender buffer space (bytes). */
220157
#define TCP_SND_BUF (TCP_MSS*4)
221158

222-
/* TCP receive window.
223-
* Must satisfy: TCP_WND <= PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - 54).
224-
* With PBUF_POOL_SIZE=12 and PBUF_POOL_BUFSIZE=1516: max = 12 * 1462 = 17544.
225-
* 16384 (16 KB) fits comfortably and still gives ample throughput on LAN. */
226-
#define TCP_WND 16384
159+
/* TCP receive window. */
160+
#define TCP_WND 32768
227161

228162
/* ---------- DHCP options ---------- */
229163
#ifdef PS2IP_DHCP
@@ -233,10 +167,6 @@
233167
#define LWIP_DHCP 1
234168
#endif
235169

236-
/* ---------- ACD options ---------- */
237-
#define LWIP_ACD 0
238-
#define LWIP_DHCP_DOES_ACD_CHECK 0
239-
240170
/**
241171
* DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address.
242172
*/
@@ -306,8 +236,6 @@
306236
*/
307237
#define LWIP_CHECKSUM_ON_COPY 1
308238

309-
/* Use PS2SDK's errno.h instead of lwIP's own errno definitions */
310-
#define LWIP_ERRNO_STDINCLUDE 1
311239
/*
312240
------------------------------------
313241
---------- Socket options ----------
@@ -323,11 +251,6 @@
323251
* names (read, write & close). (only used if you use sockets.c)
324252
*/
325253
#define LWIP_POSIX_SOCKETS_IO_NAMES 0
326-
/**
327-
* LWIP_SOCKET_POLL==1: Enable poll() for sockets (new in lwIP 2.2.x, default=1).
328-
* Disabled: lwip_poll() is not exported by ps2ip; disabling saves code size.
329-
*/
330-
#define LWIP_SOCKET_POLL 0
331254

332255
/*
333256
----------------------------------

iop/tcpip/tcpip-base/include/stdlib.h

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)