summaryrefslogtreecommitdiff
path: root/pimd/pim_msdp_packet.c
diff options
context:
space:
mode:
authoranuradhak <anuradhak@cumulusnetworks.com>2016-11-08 10:34:31 -0800
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-12-21 20:26:15 -0500
commit7667c5568fdff287ad124e6d6d39653da2241968 (patch)
tree46fd372d515d8ab4aa6971c2349520e5a57f42a4 /pimd/pim_msdp_packet.c
parent46c8aab88af4aa4ab2aca68ee854aed43227260f (diff)
pim-msdp: part-3: use SA cache for setting up SPTs
1. Added a new MSDP source reference flag for creating (S,G) entries based on the SA-cache. The RFC recommends treating as SA like rxing a (S, G) join (which is a bit different then treating like a traffic stream). 2. SA-SPT is only setup if we are RP for the group and a corresponding (*,G) exists with a non-empty OIL. 3. When an SA is moved we need to let the SPT live if it is active (this change will come in a subsequent CL). Testing done: 1. SA first; SPT setup whenever (*, G) comes around. 2. (*, G) first. As soon as SA is added SPT is setup. 3. (*, G) del with valid SA entries around. Ticket: CM-13306 Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_msdp_packet.c')
-rw-r--r--pimd/pim_msdp_packet.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/pimd/pim_msdp_packet.c b/pimd/pim_msdp_packet.c
index d6b4765714..bc6156325f 100644
--- a/pimd/pim_msdp_packet.c
+++ b/pimd/pim_msdp_packet.c
@@ -150,14 +150,17 @@ pim_msdp_write(struct thread *thread)
struct stream *s;
int num;
enum pim_msdp_tlv type;
+ int work_cnt = 0;
+ char key_str[PIM_MSDP_PEER_KEY_STRLEN];
mp = THREAD_ARG(thread);
mp->t_write = NULL;
if (PIM_DEBUG_MSDP_INTERNAL) {
- char key_str[PIM_MSDP_PEER_KEY_STRLEN];
-
pim_msdp_peer_key_dump(mp, key_str, sizeof(key_str), false);
+ }
+
+ if (PIM_DEBUG_MSDP_INTERNAL) {
zlog_debug("%s pim_msdp_write", key_str);
}
if (mp->fd < 0) {
@@ -176,7 +179,7 @@ pim_msdp_write(struct thread *thread)
return 0;
}
- sockopt_cork (mp->fd, 1);
+ sockopt_cork(mp->fd, 1);
/* Nonblocking write until TCP output buffer is full */
do
@@ -190,8 +193,12 @@ pim_msdp_write(struct thread *thread)
num = write(mp->fd, STREAM_PNT(s), writenum);
if (num < 0) {
/* write failed either retry needed or error */
- if (ERRNO_IO_RETRY(errno))
+ if (ERRNO_IO_RETRY(errno)) {
+ if (PIM_DEBUG_MSDP_INTERNAL) {
+ zlog_debug("%s pim_msdp_write io retry", key_str);
+ }
break;
+ }
/* XXX:revisit; reset TCP connection */
pim_msdp_peer_reset_tcp_conn(mp, "pkt-tx-failed");
@@ -202,9 +209,6 @@ pim_msdp_write(struct thread *thread)
/* Partial write */
stream_forward_getp(s, num);
if (PIM_DEBUG_MSDP_INTERNAL) {
- char key_str[PIM_MSDP_PEER_KEY_STRLEN];
-
- pim_msdp_peer_key_dump(mp, key_str, sizeof(key_str), false);
zlog_debug("%s pim_msdp_partial_write", key_str);
}
break;
@@ -230,12 +234,17 @@ pim_msdp_write(struct thread *thread)
/* packet sent delete it. */
pim_msdp_pkt_delete(mp);
+ ++work_cnt;
/* XXX - may need to pause if we have done too much work in this
* loop */
} while ((s = stream_fifo_head(mp->obuf)) != NULL);
pim_msdp_write_proceed_actions(mp);
- sockopt_cork (mp->fd, 0);
+ sockopt_cork(mp->fd, 0);
+
+ if (PIM_DEBUG_MSDP_INTERNAL) {
+ zlog_debug("%s pim_msdp_write wrote %d packets", key_str, work_cnt);
+ }
return 0;
}