summaryrefslogtreecommitdiffstats
path: root/src/plugins/igmp
AgeCommit message (Expand)AuthorFilesLines
2019-01-20buffers: don't init metadata, as it is already initializedDamjan Marion1-3/+0
2018-12-13make build failure.Paul Vinciguerra1-2/+2
2018-12-06API: Change ip4_address and ip6_address to use type alias.Ole Troan1-2/+2
2018-11-14Remove c-11 memcpy checks from perf-critical codeDave Barach2-8/+8
2018-11-13IGMP: improve CLI debug outputNeale Ranns9-42/+163
2018-11-06IGMP: Improved handling of (*,G) join and leaveNeale Ranns1-20/+74
2018-10-23c11 safe string handling supportDave Barach6-12/+12
2018-10-16IGMP: proxy deviceJakub Grajciar15-12/+749
2018-10-01IGMP: handle (*,G) report with no source addressesNeale Ranns1-8/+14
2018-09-24Trivial: Clean up some typos.Paul Vinciguerra12-17/+17
2018-08-27IGMP: enable command on cliNeale Ranns4-2/+84
2018-08-27cmake: Fix plugins .h includesMohsin Kazmi1-0/+4
2018-08-25cmake: improve add_vpp_plugin macroDamjan Marion1-2/+5
2018-08-17CMake as an alternative to autotools (experimental)Damjan Marion1-0/+29
2018-07-12IGMP: validate the packets length in the DPNeale Ranns3-25/+55
2018-07-10IGMP: coverity found defectsNeale Ranns3-4/+10
2018-07-09IGMP improvementsNeale Ranns27-1734/+3760
2018-06-29igmp: bugfix and minor improvementsJakub Grajciar5-76/+60
2018-06-10IGMP: use simple u32 bit hash keyNeale Ranns3-18/+15
2018-06-08Add reaper functions to want events APIs (VPP-1304)Neale Ranns2-32/+43
2018-05-23VPP-1283: IPv4 PMTU missing MTU value in ICMP4 message.Ole Troan1-1/+1
2018-04-25igmp: disable debug messagesDamjan Marion1-1/+1
2018-04-25igmp: data structure refactoringJakub Grajciar5-350/+820
2018-04-17igmp: fix debug macroJakub Grajciar3-13/+13
2018-03-23IGMP: coverity fixes and remove checks for scapy IGMPv3Neale Ranns2-9/+5
2018-03-21IGMP plugin initialises the FIB/MFIB via ip4 moduleNeale Ranns1-1/+4
2018-03-19IGMP pluginJakub Grajciar12-0/+2720
an class="nf">i2c_delay (i2c_bus_t * b, f64 timeout) { vlib_main_t *vm = vlib_get_main (); vlib_time_wait (vm, timeout); } static void i2c_wait_for_scl (i2c_bus_t * b) { f64 t = 0; while (t < b->hold_time) { int sda, scl; i2c_delay (b, b->rise_fall_time); b->get_bits (b, &scl, &sda); if (scl) return; t += b->rise_fall_time; } b->timeout = 1; } static void i2c_start (i2c_bus_t * b) { b->timeout = 0; b->put_bits (b, 1, 1); i2c_wait_for_scl (b); if (vlib_i2c_bus_timed_out (b)) return; b->put_bits (b, 1, 0); i2c_delay (b, b->hold_time); b->put_bits (b, 0, 0); i2c_delay (b, b->hold_time); } static void i2c_stop (i2c_bus_t * b) { b->put_bits (b, 0, 0); i2c_delay (b, b->rise_fall_time); b->put_bits (b, 1, 0); i2c_delay (b, b->hold_time); b->put_bits (b, 1, 1); i2c_delay (b, b->hold_time); } static void i2c_write_bit (i2c_bus_t * b, int sda) { b->put_bits (b, 0, sda); i2c_delay (b, b->rise_fall_time); b->put_bits (b, 1, sda); i2c_wait_for_scl (b); i2c_delay (b, b->hold_time); b->put_bits (b, 0, sda); i2c_delay (b, b->rise_fall_time); } static void i2c_read_bit (i2c_bus_t * b, int *sda) { int scl; b->put_bits (b, 1, 1); i2c_wait_for_scl (b); i2c_delay (b, b->hold_time); b->get_bits (b, &scl, sda); b->put_bits (b, 0, 1); i2c_delay (b, b->rise_fall_time); } static void i2c_write_byte (i2c_bus_t * b, u8 data) { int i, sda; for (i = 7; i >= 0; i--) { i2c_write_bit (b, (data >> i) & 1); if (b->timeout) return; } b->put_bits (b, 0, 1); i2c_delay (b, b->rise_fall_time); i2c_read_bit (b, &sda); if (sda) b->timeout = 1; } static void i2c_read_byte (i2c_bus_t * b, u8 * data, int ack) { int i, sda; *data = 0; b->put_bits (b, 0, 1); i2c_delay (b, b->rise_fall_time); for (i = 7; i >= 0; i--) { i2c_read_bit (b, &sda); if (b->timeout) return; *data |= (sda != 0) << i; } i2c_write_bit (b, ack == 0); } void vlib_i2c_init (i2c_bus_t * b) { f64 tick; if (!b->clock) b->clock = 400000; tick = 1.0 / b->clock; /* Spend 40% of time in low and high states */ if (!b->hold_time) b->hold_time = 0.4 * tick; /* Spend 10% of time waiting for rise and fall */ if (!b->rise_fall_time) b->rise_fall_time = 0.1 * tick; } void vlib_i2c_xfer (i2c_bus_t * bus, i2c_msg_t * msgs) { i2c_msg_t *msg; int i; vec_foreach (msg, msgs) { i2c_start (bus); i2c_write_byte (bus, (msg->addr << 1) + (msg->flags == I2C_MSG_FLAG_READ)); if (msg->flags & I2C_MSG_FLAG_READ) for (i = 0; i < msg->len; i++) { i2c_read_byte (bus, &msg->buffer[i], /* ack */ i + 1 != msg->len); if (bus->timeout) goto done; } else for (i = 0; i < msg->len; i++) { i2c_write_byte (bus, msg->buffer[i]); if (bus->timeout) goto done; } } done: i2c_stop (bus); } void vlib_i2c_read_eeprom (i2c_bus_t * bus, u8 i2c_addr, u16 start_addr, u16 length, u8 * data) { i2c_msg_t *msg = 0; u8 start_address[1]; vec_validate (msg, 1); start_address[0] = start_addr; msg[0].addr = i2c_addr; msg[0].flags = I2C_MSG_FLAG_WRITE; msg[0].buffer = (u8 *) & start_address; msg[0].len = 1; msg[1].addr = i2c_addr; msg[1].flags = I2C_MSG_FLAG_READ; msg[1].buffer = data; msg[1].len = length; vlib_i2c_xfer (bus, msg); vec_free (msg); } /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */